New York City Pedestrian Traffic Light

This is my interpretation of the classic New York City pedestrian traffic light.
44h 33m
4× Druckdateien
0.20 mm
0.15 mm
0.40 mm
336.00 g
41
104
0
1018
aktualisiert 6. März 2023

Beschreibung

PDF

This decorative lamp is meant to represent a pedestrian traffic light. Inside the housing there is space for LED Strips. I powered my version with an ATTINY 13a, which runs a little script for the light sequence. The code can be found below.

The model can be printed entirely on the Prusa Mini, though you need to turn off the skirt for some parts. The housing needs to be printed with a layer height of 0.15mm, otherwise the slicer will place some of the support material outside of the build volume.

To finish the build you'll need m3x10 thread cutting screws, a micro-USB breakout board (such as:  https://tinyurl.com/USBbreakout) and a little switch. To stop the light from shining through the walls, I used ducktape.

Code:

#define pinRed 3
#define pinWhite 4
#define pinSwitch 2

unsigned long lastTime = 0;                 // Keeps track of the time

void setup() {
  // setup code:
  pinMode(pinRed, OUTPUT);
  pinMode(pinWhite, OUTPUT);
  pinMode(pinSwitch, INPUT);
  digitalWrite(pinRed, LOW);
  digitalWrite(pinWhite, LOW);
}

void loop() {
  if(digitalRead(pinSwitch) == HIGH){       // If the switch is on, both red and white are turned on 
   digitalWrite(pinRed, HIGH);
   digitalWrite(pinWhite, HIGH); 
  }else{                                    // If the switch is off, the    traffic light sequence is used
    digitalWrite(pinRed, LOW);
    digitalWrite(pinWhite, HIGH);
    lastTime = millis();
    while(millis() - lastTime < 30000){     // White is turned on for 30 seconds
      if(digitalRead(pinSwitch) == HIGH){   // If the switch is turned on, the sequence is aborted and the program returns to the beginnig of loop()
        return;
      }
    }
    digitalWrite(pinWhite, LOW);
    for(int i = 0; i<7; i++){               // Red blinks 6 times before being turned on continuesly
      digitalWrite(pinRed, HIGH);
      lastTime = millis();
      while(millis() - lastTime < 500){
        if(digitalRead(pinSwitch) == HIGH){ // If the switch is turned on, the sequence is aborted and the program returns to the beginnig of loop()
          return;
        }
      }
      digitalWrite(pinRed, LOW);
      lastTime = millis();
      while(millis() - lastTime < 500){
        if(digitalRead(pinSwitch) == HIGH){ // If the switch is turned on, the sequence is aborted and the program returns to the beginnig of loop()
          return;
        }
        }
      }
    digitalWrite(pinRed, HIGH);
    lastTime = millis();
    while(millis() - lastTime < 30000){     // Red is turned on for 30 seconds
      if(digitalRead(pinSwitch) == HIGH){   // If the switch is turned on, the sequence is aborted and the program returns to the beginnig of loop()
        return;
      }
    }
  }
}

Tags



Herkunft des Modells

Der Autor hat dieses Modell als seine eigene Kreation gekennzeichnet.

Lizenz