Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc.

Similar presentations


Presentation on theme: "Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc."— Presentation transcript:

1 Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc.

2 Homework Those who did not show last week show: 1.Either Knight Rider or Shooting Star 2.Potentiometer 3.New version of above with a control structure This week’s assignments: 1.Multiple switch assignment - make a project that uses at least 2 for interesting outputs. 2.Create project with two HOMEMADE switches. 3.Create a cool creative piece using at least one photocell and one other sensor and two LEDs or other outputs. This should be more than just some lights on your board, it should feel more finished - like the eyes project. As a class we’ll crit and vote on the best ones - they’ll get an extra credit mark. Criteria: creativity, function, ability to explain code, clarity of code THIS ONE MUST BE LIVE AND WORKING IN CLASS.

3 Review

4 Arduino Sketch Structure Top of sketch –Declare variables at top Initialize –setup() – run once at beginning, set pins Running –loop() – run repeatedly, after setup() Pins can be changed in loop() too, but conceptually easier in setup()

5 Arduino Programming

6 Known Good Configuration Rule #1 of experimenting: Before trying anything new, Get back to a known working state Get your entire edit->compile->upload->run working Even if it becomes so second nature to you that you feel you shouldn’t need to, do it anyway. Especially when mysterious problems arise, revert to a known state

7 Digital Input Switches make or break a connection Most inputs you’ll use are variations on switches Fundamentally, they’re all like the simple knife switch Knife Switch Toggle Switch

8 Digital Input Switches make or break a connection But Arduino wants to see a voltage Specifically, a “HIGH” (5 volts) or a “LOW” (0 volts)

9 Analog Inputs Many states, not just two (HIGH/LOW) Arduino has six ADC inputs (ADC = Analog to Digital Converter) Reads voltage between 0 to 5 volts Resolution is 10-bit (1024 states) You used this for the Potentiometer Homework exercise

10 An Analog Sensor Photocell, photoresistor, light-dependent resistor A variable resistor ANALOG Brighter light == lower resistance Photocells have range approx. 0-10k schematic symbol

11 Reading Diagrams Analog Sensor w/o Arduino shown Power Photocell Common Join Arduino pin (Analog pin 0) Resistor Ground

12 Reading Diagrams Switch w/Arduino Power LED Arduino pin (Digital pins) Ground Resistor Switch

13 Break, 10 minutes.

14 Do It Yourself! The exciting part of all this is that you can make almost anything…. If you are careful, thoughtful, and test, retest, and document your work.

15 Doing It Yourself Making Jumper Wires strip off about 1/2” of insulation Can use wire strippers, cutters, or fingers Can be a pain.. so often use pre-cut wires to save time but they do cost more.

16 Doing It Yourself The End Result ready to go in the Breadboard

17 Doing It Yourself Soldering Permanent connections When inputs and outputs need to be further away from the breadboard Demonstration (if we go to DT lab) Be careful not to overheat Watch for good connections Protect solder joints with hot glue when they are likely to be delicate or subject to stress Ventilation is good if you are doing a lot of it

18 Talking to the computer Communicating with Others Arduino can use same USB cable for programming and to talk with computers Talking to other devices uses the “Serial” commands Serial.begin() – prepare to use serial Serial.print() – send data to computer Serial.read() – read data from computer Can talk to not just computers. Most things more complex than simple sensors/actuators speak serial.

19 Talking to the computer Watch the TX/RX LEDS TX – sending to PC RX – receiving from PC Used when programming or communicating

20 Talking to the computer “serial_hello_world” Send “Hello world!” to your computer (and blink LED) Click on “Serial Monitor” to see output Watch TX LED compared to pin13 LED Assgn 1 Do this. Get it working and save it.

21 Telling Arduino what to do… “serial_read_basic” (get from ‘examples’) In “Serial Monitor” type “H”, press Send Watch pin 13 LED blink once Notice how you might not always read something, thus the “-1” check. Assign 2: Modify to print “hello world” after it receives something, but before it checks for ‘H’. This way you can verify it’s actually receiving something.

22 Cool! Now what? Now it’s your turn! Assignment 3: Add other outputs onto your board. Use different key commands to trigger them. Assignment 4: Get data in from an analog sensor and print it out in at least 3 formats. (hint: http://www.arduino.cc/en/Serial/Println) Assignment 5: Add other responses on the screen and have different sensors trigger them.

23 Homework Complete and post your work (description of project, photo of it, plus code) Assignment 1: Get basic serial communication working. Assignment 2: Modify to print “hello world” after it receives something, but before it checks for ‘H’. This way you can verify it’s actually receiving something. Assignment 3: Add other outputs onto your board. Use different key commands to trigger them. Assignment 4: Get data in from an analog sensor and print it out in at least 3 formats. (hint: http://www.arduino.cc/en/Serial/Println) Assignment 5: Add other responses on the screen and have different sensors trigger them. Extra Credit: Refine your best piece from last homework further and show in class at next class.


Download ppt "Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc."

Similar presentations


Ads by Google