Sensors with Arduino - Victoria

Sensors with Arduino - Victoria

Sensors with Arduino A MICROCONTROLLER Exercise 20 IR sensor Using IR proximity to detect objects First exploration , , <0.1 Basics>, Then open the serial monitor (which is where?) Wave your hand over the IR sensor What do you see?

What does it mean? How could you use the numbers shown in the serial monitor? Exploring further , , <0.5 Control>, Wave your hand over the IR sensor What happens? Why, what range? Varying the const int threshold will vary its sensitivity not its range Different types

Check the datasheet for performance Look up a datasheet online, for example: http://www.sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a41sk_e.pdf Exercise 21 - Flexiforce flexiforce to measure pressure Open the serial monitor and watch what happens when you flex the sensor Flexi-force script

/* Flex Sensor and LEDs created by ScottC on 23rd May 2011 updated on 16/05/2012. Exercise 21 Analog pin */ int flexReading = map(analogRead(flexPin), 130, 275, 4, 13); // int flexReading = map(analogRead(flexPin), 200, 450, 4, 13); authors modified code line // Make sure the value does not go beyond 4 or 13 int LEDnum = constrain(flexReading, 4, 13);

-----------------------------------------------------*/ //Flex Sensor Pin (flexPin) //the analog pin the Flex Sensor is connected to int flexPin = 0; int flexposition; void setup() { for (int i=4; i<14; i++){ pinMode(i, OUTPUT); //sets the led pins 4 to 13 to output } } void loop(){ //Ensure to turn off ALL LEDs before continuing for (int i=4; i<14; i++){ digitalWrite(i, LOW); } Serial.begin(9600); Serial.println("sensor: "); Serial.print(flexposition); flexposition = analogRead(flexPin); /* Read the flex Level Adjust the value 130 to 275 to span 4 to 13 The values 130 and 275 may need to be widened to suit

the minimum and maximum flex levels being read by the /*Call the blink function: this will turn the LED on for 10 milliseconds, and keep it off for only 1 millisecond. You can change the blink rate by changing these values, however, I want a quick response time when the flex sensor bends, hence the small values. LEDnum determines which LED gets turned on.*/ blink(LEDnum, 10,1); } // The blink function - used to turn the LEDs on and off void blink(int LEDPin, int onTime, int offTime){ // Turn the LED on

digitalWrite(LEDPin, HIGH); // Delay so that you can see the LED go On. delay(onTime); // Turn the LED Off digitalWrite(LEDPin, LOW); // Increase this Delay if you want to see an actual blinking effect. delay(offTime); } http://arduinobasics.blogspot.co.nz/2011/05/arduino-uno-flex-sensor-and-leds.html

What does it work like? A variable resistor The more it bends the higher the resistance Notes on the code Using the serial monitor: We need to specify a comm link: Serial.begin(9600); Then we need to choose what we print to the serial monitor: Serial.println("sensor: "); //println at the end sets a carriage return (new line)

Serial.print(flexposition); flexposition = analogRead(flexPin); Alternative exercise Flex Sensor and Servo Read through the SIK script , , ,

Recently Viewed Presentations

  • Services and Resources for Businesses in North-Central CT

    Services and Resources for Businesses in North-Central CT

    Online Training and Certification Programs. ... including Jobs Funnel, Best Chance, Ready-to-Work/REACH, Healthcare and Manufacturing Sector Initiatives, and Opportunity Youth programs. ... Community Colleges, DECD, community based organizations, and others. CWP Business Services: Need and ...
  • The Jeans Project - Weebly

    The Jeans Project - Weebly

    Hypothesis. Nike was hypothesized to be the must accurate. This was thought because Nike is a more popular brand, and it was the most expensive
  • Transformations for family life and the lifecourse among

    Transformations for family life and the lifecourse among

    Debunking stereotypes First, some comparisons to show the striking variations within Spain itself: people who report that are of Spanish vs. foreign nationality Selected nationalities within Spain - some surprising similarities, differences, trends Moroccans and Colombians in Spain, 2007 Malians...
  • Economics &amp; Management of Privatization

    Economics & Management of Privatization

    Economics & Management of Privatization Professor Simon Hakim [email protected] * Privatization of Adoption: Lessons Learned * Partial contracting out of adoption service delivery in MI, KS, IL, and FL increased efficiency compared to Gov't monopoly.
  • Louisiana Teen Readers&#x27; Choice Award

    Louisiana Teen Readers' Choice Award

    While she still has nightmares about finding the scene of the crime, her mother's murder did give her extra motivation to practice her skill for profiling people, an ability she inherited from her mother in the first place; in fact,...
  • Spin-Momentum Correlations, Aharonov-Bohm, and Color ...

    Spin-Momentum Correlations, Aharonov-Bohm, and Color ...

    Color Christine Aidala, CENPA Seminar, 2/1/18 Accounted for theoretically from beginning of QCD, but more detailed, potentially observable effects of color flow have come to forefront in last few years . . .
  • SBCDP Sharing Session 8 March, 08

    SBCDP Sharing Session 8 March, 08

    Choosing rhythmic poems Demonstrating how rapping is conducted (showed to students a website for rapping + teachers' self-made video on rapping) Adding some personal responses, imagery, repetition, onomatopoeia, gestures etc to let students interact with the poem Helping less able...
  • Exercise as Medicine Michael J. Falvo, PhD, RCEP

    Exercise as Medicine Michael J. Falvo, PhD, RCEP

    Medicalize Obesity or Deconditioning? AMA classifies obesity as a disease. Did they forget . deconditioning? "If . deconditioning. were a recognized syndrome or diagnosis like hypertension, diabetes and POTS, it would be easier to educate the general public and medical...