Exploring Arduino
From Physical Programming
Since I borrowed one of the RMIT's Borduino back home, I've been playing around with it pretty often. Maybe because electronics and programmings skills are quite essential to my major project as well.
I started with using Arduino IDE to controls LEDs and learning by doing some basic projects from the Arduino Book that available online @ [www.arduino.cc]. The book is very useful, it shows how to connect serveral things to Arduino, such as push button, LEDs, LDR sensor.
At this stage, I'm not really confident that I would be able to learn how to do interactive project 'sound responsive lighting' that I want in time. But still, I played with different types of sensor and switch, just to learn more about wiring them up and programming them as well.
Here's the picture of what I recently create using Borduino + USB + LEDs + Mercury Switch + LDR light sensor + 10k resistors.
The lower 3 Flashing LEDs response to the amount of light in its environment using LDR sensor, the position of the LEDs indicate the amount of light by LOW-MID-HIGH from Blue-Orange-White. The upper LEDs response to the angle that the bread board is at using mercury switch, the LEDs lit across from left to right when tilt to the right and the other way around.
Here's the link to the vdo [1]
Here's the code;
NOTE!! I use 'LED' library I got from Arduino Playground, just to make life easier.
- include <LED.h>
int LDRPin= 2; int MQRPin= 1; LED ledPin[]= {LED(9),LED(10),LED(13)}; int val1= 0; int val2= 0; LED led1 = LED(2); LED led2 = LED(3); LED led3 = LED(4); LED led4 = LED(9); LED led5 = LED(10); LED led6 = LED(11);
void setup() {
Serial.begin(9600); pinMode(LDRPin, INPUT); pinMode(MQRPin, INPUT);
}
void loop() {
val1= analogRead(LDRPin); val2= analogRead(MQRPin); Serial.println(val1); Serial.println(val2);
{
if (val1 < 100)
{
led4.fadeIn(val1); delay(val1); led4.fadeOut(val1); delay(val1);
} else if (val1 > 100);(val1 < 300); {
led5.blink(30); delay(val1);
} if (val1 > 300) {
led6.fadeIn(val1); delay(val1); led6.fadeOut(val1); delay(val1);
} }
{
if (val2 > 100)
{
led1.fadeIn(100); delay(10); led1.fadeOut(100); delay(10); led2.fadeIn(100); delay(10); led2.fadeOut(100); delay(10); led3.fadeIn(100); delay(10); led3.on(); led2.off(); led1.off();
} else {
led3.fadeIn(100); delay(10); led3.fadeOut(100); delay(10); led2.fadeIn(100); delay(10); led2.fadeOut(100); delay(10); led1.fadeIn(100); delay(10); led1.on(); led2.off(); led3.off();
} }
}
Later, i added a final touch to the unit by put a box shaped packaging foam on top as shades.
Here's the link to another VDO CLIP [2]
I'll try to improve my skills and keep updating the progress.











