The overall point of this project was not to make litho boxes but that is what ended up happening. I wanted to make lights that would alert my wife andI to how close our truck was to the wall when parking in the garage. I modified the sensor code off the Arduino website and made some litho boxes to be illuminated by the LEDs.
The Boxes: The boxes turned out to be quite awesome. I realized when I was making them that these could also be used as a decoration to spell out someone's name or to make a cool custom lamp.Each box contains a LED and a wire that runs to the board. The boxes have a passthrough channel so the wires are hidden. Each litho pane slides in so you can change them without removing the boxes. Be careful when printing as there is a left, right and middle box. Make sure that when connecting your LED that you use a resistor that is suited to your LED.
Litho panes: I used paulbovbel litho pane customizer and in my slicer. I made them .75 of the original. The panes, as I said above, are able to slide into the the boxes without removing the boxes themselves, enabeling you to change what appears easlly.
Thank you paulbovbl! LINK----> http://bit.ly/SWEETLITHO to his page.
Not included: I did print a case for the arduino and the ultrasonic sensors; however, since I did not make these I will not include the files. A quick search and you will find many suited to your needs.
#define trigPin 7
#define echoPin 6
#define led 13
#define led2 12
#define led3 11
#define led4 10
#define led5 9
#define led6 8
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 > 13 && distance < 200) { //green 1
digitalWrite(led, HIGH);
}
else {
digitalWrite(led,LOW);
}
if (distance > 13 && distance < 125) { //green2
digitalWrite(led2, HIGH);
}
else {
digitalWrite(led2, LOW);
}
if (distance > 13 && distance < 100) { //yellow 1
digitalWrite(led3, HIGH);
}
else {
digitalWrite(led3, LOW);
}
if (distance > 13 && distance < 50) { //yellow 2
digitalWrite(led4, HIGH);
}
else {
digitalWrite(led4,LOW);
}
if (distance > 13 && distance < 30) { //red1
digitalWrite(led5, HIGH);
}
else {
digitalWrite(led5,LOW);
}
if (distance > 13 && distance < 20) { //red2
digitalWrite(led6, HIGH);
}
else {
digitalWrite(led6,LOW);
}
if (distance >=200 || distance <=13){
Serial.println("Out of range");
}
else {
Serial.print(distance);
Serial.println(" cm");
}
}
Comments