Inspiration
Artists
Projects that try to make electronics production fairer
Parts & Projects
- Variable resistors (voltage dividers) & analog sensors
- HC-SR04
- I2C Protocol
- Beginning of the Little EFA Robot
Code During Class
#define TRIG_PIN 3
#define ECHO_PIN 2
int light;
int distance;
long duration;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
light = readLight();
distance = readUltrasonic();
Serial.println(light);
delay(60);
}
int readLight() {
int tempVal = analogRead(A0);
return tempVal;
}
int readUltrasonic() {
// clear the Trigger pin
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
// create pulse
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
// Read the Echo pin
duration = pulseIn(ECHO_PIN, HIGH);
// Calculate the distance
int tempDistance = duration / 58;
if (tempDistance < 400) {
return tempDistance;
} else {
return distance;
}
}
Homework
The Little EFA Robot
If you were not in class, build the EFA robot up to the point where you have all the mechanical parts built and from the electronics side, you should have the ultrasonic sensor and the light sensor hooked up to the Arduino. You should also have the code done that reads both sensors and prints out their values on the serial port.
You will get the H-Bridge for controlling the motors next week.
Project Proposal
I have a little bit rethought how I’m expecting the project proposal from you. I’m not expecting a finished document this week. Instead, I would like all of you to create an online document (Google Docs, Microsoft Sharepoint (Aalto)) or some other document you can share to me and keep on editing throughout the course. I should also have the possibility to add comments to it or edit it.
Please create the first version latest on Tuesday, November 17.
For the first version:
- Some short thoughts on what you would like to explore and wok with
- Some references (artworks/projects that are similar to what you would like to do)
- Initial list of parts and components you think you will need
I can then add comments directly to your document and you can keep updating it as the course goes on. Try to update it every week with some more details. There will be a MyCourses assignment where you can submit the link.