2015年2月10日 星期二

Week 3 ( PING sensor/ LCD sensor)


In this lesson, we continued to use different sensor to produce different output.

PING Sensor

We first connect the PING sensor by the hardware setup:

  • connect the SIGNAL pin on the Ping))) to pin D7 on our Arduino.
  • 5V output from Arduino to 5V input of the sensor and GROUND to GROUND. 

After we have connected the PING sensor with the Arduino, actually we can listen a little sound which released by the PING sensor. I guess it is because of the echo around the sensor? and the pulse which released by the Arduino and the second pulse by the PING sensor. 

We are then need to make a LED turn on and the distance should be less than 10 cm by using the sensor with the resistor. We have learnt a new code language which is represent "less than" in the coding which is <. We also need to use the If statement to represent if the distance between the object and the PING sensor is less than 10 cm. 



 When we put the hand near the sensor by no more than 10 cm, the LED will turn on. If the hand is near the sensor more than 10 cm, the LED will not turn on.

Serial LCD


Lastly, we have used the serial LCD to display the texts or numbers which can type by ourselves. We just used the sample code and change the words inside the code so that it can display "Hello World!". 




沒有留言:

張貼留言