(human ± technology) let's update together
Are you interested in this question/provocation? If so how & why
Please post updates below:
- Photos of meet-up activities
- Photo or list of any notes
- Names of attendees
- Dates of future meet-ups
- Links to any online planning spaces like Facebook groups etc.
India Gabb Wed 13 Dec 2017 4:39PM
Software which may help programme the leds http://www.solderlab.de/index.php/software/glediator
Lucy Wed 13 Dec 2017 4:55PM
RGB LED ANALOGUE CONTROL CODE:
int redPin = 9; //Pin for the red RGB led pin
int greenPin = 10; //Pin for the green RGB led pin
int bluePin = 11; //Pin for the blue RGB led pin
int potPin_red = A0; //declare pin for the potentiometer for the red LED
int potPin_green = A1; //declare pin for the potentiometer for the green LED
int potPin_blue = A2; //declare pin for the potentiometer for the blue LED
int readValue_red; //declare variable to store the read value from the potentiometer which controls the red LED
int readValue_green; //declare variable to store the read value from the potentiometer which controls the green LED
int readValue_blue; //declare variable to store the read value from the potentiometer which controls the blue LED
int writeValue_red; //declare variable to send to the red LED
int writeValue_green; //declare variable to send to the green LED
int writeValue_blue; //declare variable to send to the blue LED
void setup() {
pinMode(potPin_red, INPUT); //set potentiometer for red LED as input
pinMode(potPin_green, INPUT); //set potentiometer for green LED as input
pinMode(potPin_blue, INPUT); //set potentiometer for blue LED as input
pinMode(redPin,OUTPUT); //set pin for red LED as output
pinMode(bluePin,OUTPUT); //set pin for green LED as output
pinMode(greenPin, OUTPUT); //set pin for blue LED as output
}
void loop() {
readValue_red = analogRead(potPin_red); //Read voltage from potentiometer to control red LED
readValue_green = analogRead(potPin_green); //Read voltage from potentiometer to control green LED
readValue_blue = analogRead(potPin_blue); //Read voltage from potentiometer to control blue LED
writeValue_red = (255./1023.)*readValue_red; //Calculate the value to write on the red LED (add point to change to float point)
writeValue_green = (255./1023.)*readValue_green; //Calculate the value to write on the green LED
writeValue_blue = (255./1023.)*readValue_blue; ///Calculate the value to write on the blue LED
analogWrite(redPin,writeValue_red); //write value to set the brightness of the red LED
analogWrite(greenPin,writeValue_green); //write value to set the brightness of the green LED
analogWrite(bluePin,writeValue_blue); //write value to set the brightness of the blue LED
}
Lucy Wed 13 Dec 2017 4:57PM
MOTION SENSOR LIGHTS CODE:
#define trigPin 7
#define echoPin 6
#define led 13
#define led2 12
#define led3 11
#define led4 10
#define led5 9
#define led6 8
int sound = 250;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance <= 30) {
digitalWrite(led, HIGH);
sound = 250;
}
else {
digitalWrite(led,LOW);
}
if (distance < 25) {
digitalWrite(led2, HIGH);
sound = 260;
}
else {
digitalWrite(led2, LOW);
}
if (distance < 20) {
digitalWrite(led3, HIGH);
sound = 270;
}
else {
digitalWrite(led3, LOW);
}
if (distance < 15) {
digitalWrite(led4, HIGH);
sound = 280;
}
else {
digitalWrite(led4,LOW);
}
if (distance < 10) {
digitalWrite(led5, HIGH);
sound = 290;
}
else {
digitalWrite(led5,LOW);
}
if (distance < 5) {
digitalWrite(led6, HIGH);
sound = 300;
}
else {
digitalWrite(led6,LOW);
}
if (distance > 30 || distance <= 0){
Serial.println("Out of range");
}
else {
Serial.print(distance);
Serial.println(" cm");
}
delay(500);
}
Lucy Wed 13 Dec 2017 5:22PM
Lucy Wed 13 Dec 2017 5:23PM
https://engmousaalkaabi.blogspot.co.uk/2015/09/distance-meter-with-6-leds-using.html link for motion light sensors
Nicola Rae Thu 14 Dec 2017 3:32PM
Managed to get the Arduino Motion Light Sensor to work!!! Although I really should be focusing on other things at the moment...
Lucy Wed 20 Dec 2017 10:18PM
:slight_smile:
Lucy Wed 20 Dec 2017 10:15PM
http://www.instructables.com/id/Arduino-Distance-Detector-with-a-Buzzer-and-LEDs/ please follow this link for more help -- Nicola found this easy to follow!
Lucy Wed 20 Dec 2017 11:01PM
A Video of Our Arduino Motion Sensors
India Gabb · Wed 13 Dec 2017 2:43PM
RGB LED instructions:
http://www.instructables.com/id/How-to-use-an-RGB-LED-Arduino-Tutorial/