WeMOS: AnalogRead

From OnnoWiki
Jump to navigation Jump to search

Code

/////////////////////////////////
// Generated with a lot of love//
// with TUNIOT FOR ESP8266     //
// Website: Easycoding.tn      //
/////////////////////////////////

void setup()
{
  Serial.begin(115200);
}

void loop()
{
    Serial.println(analogRead(A0));
    delay(1000);
}


Code dengan 7 segmen

#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);
}


Pranala Menarik