Week 2 - Workshop and Lecture

Ive purchased my own Arduino board now and can start experimenting at home.

During this lecture Vasco, William and me played a little more with the code and the potentiometer and managed to control the blinking speed from the LED via the potentiometer.

The following code was used to achieve this,



int potPin = 2; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600); // initiate serial port
}

void loop() {
val = analogRead(potPin); // read the value from the sensor
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val+100); // stop the program for some time
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val+100); // stop the program for some time
Serial.println(val); // print serial input data to serial log screen
}



photos,






videos,



During the workshop it became clear to me that the possibilities with the Arduino board are almost endless. Its just now combining all these possibilities together to create something creative and intuitive.

I will try to research some more on what kind of peripherals can be used with Arduino and also to experiment some more with the code.

No comments: