For our lesson with Jason, he taught us all about Arduino. Arduino is an electronics prototyping with a series of micro-controller boards with the software to program them. It can read it's environment by receiving input from various detectors and change its surroundings, such controlling lights.On the micro-controller boards, it is programmed by 'Arduino Programming Language' which can be developed on 'Processing'. The boards can come prepared or you can build them by hand.
For the exercise, Jason split us into groups. One group was uploading data from one device which read the environments brightness onto pachube and the other group had a device with a motor and had to download the data with controlled its rotation.
We began by building the Arduinos.
Once the Arduinos was built we started to connect them to the computers by using Processing and using Arduino Library so we can visualize the data on screen. By doing this, we are able to use new inputs whilst using Processing and allow us to see the sensors as graphics. We also uploaded the data onto pachube by using EEML libary. EEML libary helps to set up connections to Pachube especially when using Arduino as it allows to share real time sensor data and can link to Processing. Therefore, Arduino and EEML sketches had to link and the link for the feeds published on Pachube and key had to be inserted. In no matter of time, the results were published.
A code which Jason recommend us to use and begin with was:
* A simple programme that will change the intensity of
* an LED based * on the amount of light incident on
* the photo resistor.
int lightPin = 0; //the analog pin the photoresistor is
//the photoresistor is not calibrated to any units so
//this is simply a raw sensor value (relative light)
int ledPin = 9; //the pin the LED is connected to
//we are controlling brightness so
//we use one of the PWM (pulse width
// modulation pins)
pinMode(ledPin, OUTPUT); //sets the led pin to output
* loop() - this function will start after setup
* finishes and then repeat
int lightLevel = analogRead(lightPin); //Read the
lightLevel = map(lightLevel, 0, 900, 0, 255);
//adjust the value 0 to 900 to
//span 0 to 255
lightLevel = constrain(lightLevel, 0, 255);//make sure the
//value is betwween
//0 and 255
analogWrite(ledPin, lightLevel); //write the value