This March LitDev introduced about Arduino on this blog. Today, I’d like to introduce my Small Basic programs using Arduino.
The first one is the IR Turtle controller (HLT038).
The circuit is like (GZN399):
The Arduino program irdemo.ino is from osoyoo.com. More details about this program are described here.
The second one is a thermometer (KKK886).
The circuit is like (GZN399-0):
The Arduino program is as follows.
//TMP36 Pin Variables int sensorPin = 5; // the analog pin the TMP36's Vout (sense) pin is connected to // the resolution is 10 mV / degree centigrade with a // 500 mV offset to allow for negative temperatures float lastTemp; // last temperature /* * setup() - this function runs once when you turn your Arduino on * We initialize the serial connection with the computer */ void setup() { Serial.begin(9600); // Start the serial connection with the computer // to view the result open the serial monitor } void loop() // run over and over again { //getting the voltage reading from the temperature sensor int reading = analogRead(sensorPin); // converting that reading to voltage, for 3.3v arduino use 3300 int mV = map(reading, 0, 1023, 0, 5000); // now print out the temperature float temperatureC = (mV - 500) / 10.0 ; //converting from 10 mV per degree with 500 mV offset //to degrees ((voltage - 500mV) times 100) if (temperatureC != lastTemp) { Serial.println(temperatureC); lastTemp = temperatureC; } delay(1000); //waiting a second }
Arduino can be connected with many types of sensors or actuators. So, with this device, we can explore Small Basic world more and more interesting!