WeMOS: AnalogRead

From OnnoWiki
Revision as of 06:34, 9 November 2019 by Onnowpurbo (talk | contribs) (Created page with " #include <Wire.h> #include <TM1650.h> TM1650 d; void setup() { Wire.begin(); //Join the bus as master Serial.begin(115200); //Start serial communication at 960...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#include <Wire.h>
#include <TM1650.h>

TM1650 d;

void setup() 
{
  Wire.begin(); //Join the bus as master
  Serial.begin(115200); //Start serial communication at 9600 for debug statements
  Serial.println("TM1650 Example Code");
  d.init();   
}

void loop() {
  int sensorReading = analogRead(A0);
  char buffer[5] = "    ";
  Serial.println(sensorReading);
  d.displayOn();
  d.setBrightnessGradually(TM1650_MAX_BRIGHT);
  d.displayString(itoa(sensorReading,buffer,10));
  delay(500);
}