Untitled
unknown
plain_text
2 years ago
1.1 kB
9
Indexable
#include "SevenSegmentTM1637.h"
const byte PIN_CLK = 4; // define CLK pin (any digital pin)
const byte PIN_DIO = 5; // define DIO pin (any digital pin)
SevenSegmentTM1637 display(PIN_CLK, PIN_DIO);
char buffer[5];
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(13, OUTPUT);
pinMode(19, INPUT);
display.begin(); // initializes the display
display.setBacklight(50); // set the brightness to 100 %
display.print("INIT"); // display INIT on the display
delay(1000); // wait 1000 ms
}
long adcVal;
int counter;
void loop() {
// put your main code here, to run repeatedly:
display.clear();
digitalWrite(13, HIGH);
//if (digitalRead(19) == 1) return;
//for(int i=0; i<32; i++) {
//adcVal += analogRead(4);
//}
//adcVal /= 32;
//counter++;
//Serial.print(counter);
//Serial.print(". ");
display.clear();
adcVal = analogRead(4);
sprintf(buffer, "%4d", adcVal);
display.print(buffer);
Serial.println(buffer);
delay(250);
digitalWrite(13, LOW);
}
Editor is loading...
Leave a Comment