CODE
// BLINK void setup() { pinMode(13, OUTPUT); // set pin 13 as an output } void loop() { digitalWrite(13, LOW); // pin 13 LOW delay(1000); // wait 1 sec digitalWrite(13, HIGH); // set pin 13 HIGH delay(1000); // wait 1 sec }
// BLINK 1 #define LED 13 void setup() { pinMode(LED, OUTPUT); // set pin LED as an output } void loop() { flash(100); // timings flash(100); flash(1000); } void flash(int t) { digitalWrite(LED, LOW); // pin LED LOW delay(t); // wait t (ms) digitalWrite(LED, HIGH); // set pin LED HIGH delay(t); // wait t (ms) }
// VOLTS // measure +5V output, mine was 4.62 float volts; // ADC voltage read void setup() { Serial.begin(9600); // start serial comms } void loop() { volts = analogRead(A0) * 4.62 / 1023; // read ADC -> volts, "+5V" ref Serial.println(volts); // display on Monitor delay(100); }
No comments:
Post a Comment