GMU:Designing Utopias: Theory and Practice/Selena Deger: Difference between revisions
Line 3: | Line 3: | ||
=='''line tracking sensor'''== | =='''line tracking sensor'''== | ||
https://wiki.keyestudio.com/Ks0050_keyestudio_Line_Tracking_Sensor | https://wiki.keyestudio.com/Ks0050_keyestudio_Line_Tracking_Sensor | ||
Line tracking sensor can be used to differentiate between black and white with the integrated infrared sensors(one emitting, one collecting). It is very dependent on the reflectiveness of the material/object therefore it is important to have a consistent and equal light source on the surface. | |||
'''experiments''' | '''experiments''' | ||
Line 13: | Line 14: | ||
</gallery> | </gallery> | ||
To get different numbers from the sensor(other than hi/lo), I connected it to an analog input. | |||
To get different numbers from the sensor(other than hi/lo), I connected it to an analog input. | |||
<source style="border:none; height:auto; overflow:scroll;" lang="c" line start="55" highlight="4"> | |||
void setup() | |||
{ | |||
Serial.begin(9600); | |||
} | |||
void loop() | |||
{ | |||
Serial.println(analogRead(A0)); // print the data from the sensor | |||
delay(500); | |||
} | |||
</source> | |||
<gallery> | <gallery> | ||
File:sel_analog1.JPG | File:sel_analog1.JPG | ||
File: | File:sel_analog2.JPG | ||
File:sel_analog3.JPG | |||
</gallery> | </gallery> | ||
Following this tutorial > https://www.arduino.cc/education/visualization-with-arduino-and-processing | |||
I have first uploaded this code snippet to the arduino | |||
<source style="border:none; height:auto; overflow:scroll;" lang="c" line start="55" highlight="4"> | |||
unsigned int ADCValue; | |||
void setup(){ | |||
Serial.begin(9600); | |||
} | |||
void loop(){ | |||
int val = analogRead(0); | |||
val = map(val, 0, 300, 0, 255); | |||
Serial.println(val); | |||
delay(50); | |||
} | |||
</source> | |||
Lastly running different examples from the same tutorial on processing, resulted in different visualization of the black/white data retrieved from the sensor. | |||
[[File:sel_processing.mp4]] |
Revision as of 22:30, 30 November 2022
December 1
line tracking sensor
https://wiki.keyestudio.com/Ks0050_keyestudio_Line_Tracking_Sensor Line tracking sensor can be used to differentiate between black and white with the integrated infrared sensors(one emitting, one collecting). It is very dependent on the reflectiveness of the material/object therefore it is important to have a consistent and equal light source on the surface.
experiments
After following the instructions in the producer website, I have managed to get the first digital outputs from the sensor.
To get different numbers from the sensor(other than hi/lo), I connected it to an analog input.
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(analogRead(A0)); // print the data from the sensor
delay(500);
}
Following this tutorial > https://www.arduino.cc/education/visualization-with-arduino-and-processing
I have first uploaded this code snippet to the arduino
unsigned int ADCValue;
void setup(){
Serial.begin(9600);
}
void loop(){
int val = analogRead(0);
val = map(val, 0, 300, 0, 255);
Serial.println(val);
delay(50);
}
Lastly running different examples from the same tutorial on processing, resulted in different visualization of the black/white data retrieved from the sensor.