This is an Introduction to Engineering Design Lab (assignment request: Arduino Coding Activity) using a TinkerCad. It’s free Online...

1 answer below »
This is an Introduction to Engineering Design Lab (assignment request: Arduino Coding Activity) using a TinkerCad. It’s free Online (https://www.tinkercad.com/dashboard?type=circuits&collection=designs) as guided in the attached assignment instructions files.Follow instructions for the Arduino Coding Activity criteria and assignment submission rubic on the lab manual attached. Please "submit using (Microsoft word), vet solutions for plagiarism and submission deadline are to be strictly adhered to as required.



Activity: Arduino Coding (Individual) Objectives In this activity you will • Predict the outcomes of programs in Arduino involving conditional and looping statements. • Draw an activity diagram to accomplish a given task • Write a program (in Arduino) corresponding to a given activity diagram Procedure Complete the following parts • Part 1: Predict the result of an Arduino program What will the following Arduino code print on the serial monitor? Try not to paste this code into Arduino, infer it by yourself and type the answer. int x = 1; void setup() { Serial.begin(9600); } void loop() { if (x < 10)="" {="" serial.println(x);="" x="x+1;" }="" else="" {="" serial.println(x);="" }="" }="" •="" part="" 2:="" predict="" the="" result="" of="" an="" arduino="" program="" what="" will="" the="" following="" arduino="" code="" make="" the="" motor="" do?="" explain="" in="" less="" than="" 3="" sentences,="" no="" "essays"="" please.="" in="" this="" setup,="" a="" motor="" is="" connected="" to="" the="" output="" pins="" of="" an="" l298n="" or="" l298d="" board,="" and="" the="" input="" pins="" of="" the="" board="" are="" connected="" to="" an="" arduino's="" pin11="" and="" pin="" 10.="" thus,="" these="" two="" pins="" control="" the="" motor.="" assume="" the="" board="" is="" already="" enabled.="" a="" distance="" sensor="" (hcsr04)="" is="" also="" connected="" to="" arduino.="" its="" trigger="" is="" connected="" to="" pin="" 2,="" and="" echo="" is="" connected="" to="" pin="" 3.="" here="" is="" the="" code:="" int="" motorpin1="11;" int="" motorpin2="10;" int="" trigger_pin="2;" int="" echo_pin="3;" long="" pulse_duration,="" distance_in_inches;="" void="" setup()="" {="" pinmode(motorpin1,="" output);="" pinmode(motorpin2,="" output);="" pinmode(trigger_pin,="" output);="" pinmode(echo_pin,="" input);="" serial.begin(9600);="" }="" void="" loop()="" {="" read="" the="" distance="" digitalwrite(trigger_pin,="" low);="" delaymicroseconds(2);="" digitalwrite(trigger_pin,="" high);="" delaymicroseconds(10);="" digitalwrite(trigger_pin,="" low);="" pulse_duration="pulseIn(echo_pin," high);="" distance_in_inches="pulse_duration" 147.82;="" serial.println(distance_in_inches);="" delay(10);="" do="" stuff="" if="" (distance_in_inches=""> 10) { digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); } else { if (distance_in_inches < 2) { digitalwrite(motorpin1, low); digitalwrite(motorpin2, high); } else { digitalwrite(motorpin1, low); digitalwrite(motorpin2, low); } } } • part 3: arduino program from a given flowchart here is a flow chart/activity of some algorithm. please write a complete arduino code which will accomplish the same. hint: you can always make the circuit in tinkercad (available free online) and test your code if it works! part 4: flowchart for a given algorithm there is a straight road many miles long. the road is black in color, but it has a white line/strip running in its middle. a car (shown as a red rectangle) is supposed to travel on the white line. the car is driven by a motor system, and there are two color sensors in front of the car. the color sensors are marked by two black dots as shown in the figure below, and each color sensor can see the color of the road directly below where they are mounted. draw a flowchart/activity diagram (not the arduino code) which can eventually be run on some arduino like system, which will drive the car forward on the white line/strip. initially the car starts in the position as shown above. the two sensors are on the white line, and car is moving forward (i.e. no steering). the car would have moved forward perfectly, but it can veer off due to random effects beyond your control. if the car veers off the white line, then the flowchart algorithm should direct it to steer back onto the white line again. in the boxes of the flowchart, you are only allowed to use some/all of the following sentences / words: 'start', 'turn left', 'turn right', 'move forward (no steer)', 'is the left sensor seeing white?', 'is the left sensor seeing black?', 'is the right sensor seeing white?', 'is the right sensor seeing black?', 'yes', 'and', 'no'. note there is no 'stopping' option. submission and rubric you will submit a report as a single presentation on word document for this activity that includes all the following information: • name of the activity • results from part 1 (5 points total) • results from part 2 (5 points total) • results from part 3 (10 points total) o 6 points for the correct algorithm logic o 4 points for the correct syntax in arudino coding • results from part 4 (10 points total) o 1 point for correct shapes for various boxes in the flowchart o 3 points for the moving forward part make surely on the correct keywords are used in the boxes of the flowcharts. o 3 points for the turning left part, make surely on the correct keywords are used in the boxes of the flowcharts. o 3 points for the turning left part, make surely on the correct keywords are used in the boxes of the flowcharts. o 2 points extra for taking care of the case when both the sensors are off the white line (stopping or reversing is not allowed in this case) please use tinkercad (available free online for the arduino coding) extra practice problems for arduino coding 1. find the mistakes in the following arduino code and provide fixes. int motorpin1 = 11; void setup() { pinmode(motorpin1, output); pinmode(motorpin2, output) } voidloop() { digitalwrite(motorpin1, high); digitalwrite(motorpin2, low); delay(1500); digitalwrite(motorpin1, low); digitalwrite(motorpin2, high); delay(1000); solution: 1. did not initialize motor pin 2 (insert on line 2): int motorpin2 = 10; 2. missing semicolon after setup of motor pin 2 (line 5): pinmode(motorpin2, output); 3. missing a space between "void" and "loop" (line 8): void loop() { 4. missing capitalization (line 9): digitalwrite(motorpin1, high); 5. improper capitalization (line 12): digitalwrite(motorpin1); 6. missing closing parentheses (line 15): delay(1000); } 2. write a code which will print the following in the serial monitor: 1 2 3 4 5 6 7 8 9 … and so on forever solution: int x =1 ; void setup() { serial.begin(9600); } void loop() { 2)="" {="" digitalwrite(motorpin1,="" low);="" digitalwrite(motorpin2,="" high);="" }="" else="" {="" digitalwrite(motorpin1,="" low);="" digitalwrite(motorpin2,="" low);="" }="" }="" }="" •="" part="" 3:="" arduino="" program="" from="" a="" given="" flowchart="" here="" is="" a="" flow="" chart/activity="" of="" some="" algorithm.="" please="" write="" a="" complete="" arduino="" code="" which="" will="" accomplish="" the="" same.="" hint:="" you="" can="" always="" make="" the="" circuit="" in="" tinkercad="" (available="" free="" online)="" and="" test="" your="" code="" if="" it="" works!="" part="" 4:="" flowchart="" for="" a="" given="" algorithm="" there="" is="" a="" straight="" road="" many="" miles="" long.="" the="" road="" is="" black="" in="" color,="" but="" it="" has="" a="" white="" line/strip="" running="" in="" its="" middle.="" a="" car="" (shown="" as="" a="" red="" rectangle)="" is="" supposed="" to="" travel="" on="" the="" white="" line.="" the="" car="" is="" driven="" by="" a="" motor="" system,="" and="" there="" are="" two="" color="" sensors="" in="" front="" of="" the="" car.="" the="" color="" sensors="" are="" marked="" by="" two="" black="" dots="" as="" shown="" in="" the="" figure="" below,="" and="" each="" color="" sensor="" can="" see="" the="" color="" of="" the="" road="" directly="" below="" where="" they="" are="" mounted.="" draw="" a="" flowchart/activity="" diagram="" (not="" the="" arduino="" code)="" which="" can="" eventually="" be="" run="" on="" some="" arduino="" like="" system,="" which="" will="" drive="" the="" car="" forward="" on="" the="" white="" line/strip.="" initially="" the="" car="" starts="" in="" the="" position="" as="" shown="" above.="" the="" two="" sensors="" are="" on="" the="" white="" line,="" and="" car="" is="" moving="" forward="" (i.e.="" no="" steering).="" the="" car="" would="" have="" moved="" forward="" perfectly,="" but="" it="" can="" veer="" off="" due="" to="" random="" effects="" beyond="" your="" control.="" if="" the="" car="" veers="" off="" the="" white="" line,="" then="" the="" flowchart="" algorithm="" should="" direct="" it="" to="" steer="" back="" onto="" the="" white="" line="" again.="" in="" the="" boxes="" of="" the="" flowchart,="" you="" are="" only="" allowed="" to="" use="" some/all="" of="" the="" following="" sentences="" words:="" 'start',="" 'turn="" left',="" 'turn="" right',="" 'move="" forward="" (no="" steer)',="" 'is="" the="" left="" sensor="" seeing="" white?',="" 'is="" the="" left="" sensor="" seeing="" black?',="" 'is="" the="" right="" sensor="" seeing="" white?',="" 'is="" the="" right="" sensor="" seeing="" black?',="" 'yes',="" 'and',="" 'no'.="" note="" there="" is="" no="" 'stopping'="" option.="" submission="" and="" rubric="" you="" will="" submit="" a="" report="" as="" a="" single="" presentation="" on="" word="" document="" for="" this="" activity="" that="" includes="" all="" the="" following="" information:="" •="" name="" of="" the="" activity="" •="" results="" from="" part="" 1="" (5="" points="" total)="" •="" results="" from="" part="" 2="" (5="" points="" total)="" •="" results="" from="" part="" 3="" (10="" points="" total)="" o="" 6="" points="" for="" the="" correct="" algorithm="" logic="" o="" 4="" points="" for="" the="" correct="" syntax="" in="" arudino="" coding="" •="" results="" from="" part="" 4="" (10="" points="" total)="" o="" 1="" point="" for="" correct="" shapes="" for="" various="" boxes="" in="" the="" flowchart="" o="" 3="" points="" for="" the="" moving="" forward="" part="" make="" surely="" on="" the="" correct="" keywords="" are="" used="" in="" the="" boxes="" of="" the="" flowcharts.="" o="" 3="" points="" for="" the="" turning="" left="" part,="" make="" surely="" on="" the="" correct="" keywords="" are="" used="" in="" the="" boxes="" of="" the="" flowcharts.="" o="" 3="" points="" for="" the="" turning="" left="" part,="" make="" surely="" on="" the="" correct="" keywords="" are="" used="" in="" the="" boxes="" of="" the="" flowcharts.="" o="" 2="" points="" extra="" for="" taking="" care="" of="" the="" case="" when="" both="" the="" sensors="" are="" off="" the="" white="" line="" (stopping="" or="" reversing="" is="" not="" allowed="" in="" this="" case)="" please="" use="" tinkercad="" (available="" free="" online="" for="" the="" arduino="" coding)="" extra="" practice="" problems="" for="" arduino="" coding="" 1.="" find="" the="" mistakes="" in="" the="" following="" arduino="" code="" and="" provide="" fixes.="" int="" motorpin1="11;" void="" setup()="" {="" pinmode(motorpin1,="" output);="" pinmode(motorpin2,="" output)="" }="" voidloop()="" {="" digitalwrite(motorpin1,="" high);="" digitalwrite(motorpin2,="" low);="" delay(1500);="" digitalwrite(motorpin1,="" low);="" digitalwrite(motorpin2,="" high);="" delay(1000);="" solution:="" 1.="" did="" not="" initialize="" motor="" pin="" 2="" (insert="" on="" line="" 2):="" int="" motorpin2="10;" 2.="" missing="" semicolon="" after="" setup="" of="" motor="" pin="" 2="" (line="" 5):="" pinmode(motorpin2,="" output);="" 3.="" missing="" a="" space="" between="" "void"="" and="" "loop"="" (line="" 8):="" void="" loop()="" {="" 4.="" missing="" capitalization="" (line="" 9):="" digitalwrite(motorpin1,="" high);="" 5.="" improper="" capitalization="" (line="" 12):="" digitalwrite(motorpin1);="" 6.="" missing="" closing="" parentheses="" (line="" 15):="" delay(1000);="" }="" 2.="" write="" a="" code="" which="" will="" print="" the="" following="" in="" the="" serial="" monitor:="" 1="" 2="" 3="" 4="" 5="" 6="" 7="" 8="" 9="" …="" and="" so="" on="" forever="" solution:="" int="" x="1" ;="" void="" setup()="" {="" serial.begin(9600);="" }="" void="" loop()="">
Answered Same DaySep 18, 2021

Answer To: This is an Introduction to Engineering Design Lab (assignment request: Arduino Coding Activity)...

Rahul answered on Sep 19 2021
149 Votes
Name of the activity: Arduino Coding (Individual)
Part 1 (Predict the result of an Arduino program
):
There are two conditions in the program. The first condition is till x<10 and the other condition is x>=10. In the first condition, it prints the number in the serial monitor from 1 and then increment it by 1 till the number <10. In the next condition , it only prints 10 in the serial...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here