User Tools

Site Tools


Site Tools

Arduino


Communication

To communicate with the Arduino, the best way I found is to simply use Python. All other methods do not work on all systems, especially on Ubuntu based linux. I found this solution here : http://shallowsky.com/blog/2011/Oct/16/

When you have loaded the program into your arduino, stop the IDE (only one program can listen on Serial at a time), and launch python. Then, you can listen on Serial port for Arduino using :

import serial
ser = serial.Serial("/dev/ttyUSB0", 9600)
while True:
   print ser.readline()

By replacing /dev/ttyUSB0 by your local interface. In my case, the interface was /dev/ttyMAC0 or /dev/ttyMAC1. You are now free to record your arduino output into a file on your PC or something else, Python is one of the most complete language. If you get “Cannot open /dev/ttyACM0: Permission denied”. or something like that, it means that you are not a member of dialout group. On Debian base linux, use :

sudo adduser myuseraccount dialout

Log out and login, or simply reboot, and you are done with.

Sensors

Light sensors

(from http://arduinobasics.blogspot.fr/2011/06/arduino-uno-photocell-sensing-light.html)

int photoRPin = 0; 
int lightLevel;

void setup() {
 Serial.begin(9600);

 lightLevel=analogRead(photoRPin);

}

void loop(){

 lightLevel=analogRead(photoRPin);
 Serial.println(LightLevel);
 delay(50);
}

DHT11