1 / 3
Glowing Heart — zdjęcie 1
1 / 3

Glowing Heart

Zamów wydruk tego modelu

Obliczymy ostateczną cenę na podstawie wybranego pliku. Sprawdzisz ją i zaakceptujesz przed płatnością.

Zapisane na tym urządzeniu.

Informacje o modelu

Źródło
Printables
Licencja
Creative Commons — Attribution — Noncommercial

This was my first time combing Arduino with 3d printing. Eventually, I'll have a video for this project but not at the moment.

 

Here's the very basic code that I've programmed. (subject to change)

const int analogPin = A0;   
const int redLED = 11;
const int whiteLED = 12;
const int threshold = 400;
const int OFF = 100;

void setup() {
 pinMode(redLED, OUTPUT);
 Serial.begin(9600);
}

void loop() {
 int analogValue = analogRead(analogPin);
 if (analogValue > 100 && analogValue < 300)
 {
   digitalWrite(redLED, HIGH);
   digitalWrite(whiteLED, LOW);
 } 
 else if (analogValue > 300 && analogValue < 500)
 {
   digitalWrite(redLED, LOW);
   digitalWrite(whiteLED, HIGH);
 } 
 else if (analogValue > 500 && analogValue < 800)
 {
 digitalWrite (redLED, HIGH);
 digitalWrite (whiteLED, HIGH);
 }
 else 
 {
 digitalWrite (redLED, LOW);
 digitalWrite (whiteLED, LOW);
 }

Tagi