IFD:Interaktive Elektronik 2012/5. Meeting: Difference between revisions

From Medien Wiki
m (Created page with "thumb === Step 1: Read a sensor value or potentiometer value === run this to receive singles bytes of a sensor value. Receive ...")
 
mNo edit summary
Line 7: Line 7:


<source lang="c">
<source lang="c">
char analogValue; // char is a byte
int analogValue;  
 
void setup () {
void setup () {
   Serial.begin(9600);
   Serial.begin(9600);
}
}
 
void loop () {
void loop () {
   analogValue = analogRead(A0);
   analogValue = analogRead(A0)/4;
   Serial.write(analogValue);
   Serial.write((char)analogValue); // char is a byte
   delay(100);
   delay(100);
}
}

Revision as of 14:40, 16 May 2012

Potentiometer A0 Serial Steckplatine.png


Step 1: Read a sensor value or potentiometer value

run this to receive singles bytes of a sensor value. Receive the bytes using processing, puredata or other software.


int analogValue; 
 
void setup () {
  Serial.begin(9600);
}
 
void loop () {
  analogValue = analogRead(A0)/4;
  Serial.write((char)analogValue); // char is a byte
  delay(100);
}

Step 2: Read multiple sensor values

Problems + Solutions - discussion in class. Homework: 1. Get Arduino running with one or more sensors and write a small test sketch in processing (or a program in your favourite language) to receive the two values.

2. Build a sensor of conductive material and experiment with it. Find an application using it. Document your Experiments in drawings, videos, photos.