796
edits
mNo edit summary |
mNo edit summary |
||
Line 17: | Line 17: | ||
''Technical'' | ''Technical'' | ||
To collect the electric signals the shown circut (Guided by Martin Howse) in connection to an Ardunio is used. | To collect the electric signals the shown circut (Guided by Martin Howse) in connection to an Ardunio is used. | ||
''Terms '' | |||
Arduino Code | |||
const int ledPin = 9; // the pin that the LED is attached to | |||
// the setup routine runs once when you press reset: | |||
void setup() { | |||
// initialize serial communication at 9600 bits per second: | |||
Serial.begin(9600); | |||
// initialize the ledPin as an output: | |||
pinMode(ledPin, OUTPUT); | |||
} | |||
// the loop routine runs over and over again forever: | |||
void loop() { | |||
byte brightness; | |||
// check if data has been sent from the computer: | |||
if (Serial.available()) { | |||
// read the most recent byte (which will be from 0 to 255): | |||
brightness = Serial.read(); | |||
// set the brightness of the LED: | |||
analogWrite(ledPin, brightness); | |||
} | |||
// read the input on analog pin 0: | |||
int sensorValue = analogRead(A0); | |||
// print out the value you read: | |||
Serial.println(sensorValue); | |||
delay(1000); // delay in between reads for stability | |||
} | |||
''Terms '' | |||
edits