Merci skywodd et Artouste pour vote aide !
J'ai donc branché un potard en A0 et l'afficheur en D2/D3 sur un shield Seeedstudio grove.
Voici ce que ça donne
avec le code qui va bien :
#include "TM1637.h"
#define CLK 2//pins definitions for TM1637 and can be changed to other ports
#define DIO 3
TM1637 tm1637(CLK,DIO);
void setup()
{
Serial.begin(9600);
tm1637.init();
tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
}
void loop()
{
static unsigned long t = 0;//Refreshment of the display quite 250ms
if(millis() - t > 250)
{
tm1637.display(0,(analogRead(A0) / 1000) % 10); //Display of thousands
tm1637.display(1,(analogRead(A0) / 100) % 10); //Display of hundreds
tm1637.display(2,(analogRead(A0) / 10) % 10); //Display of tens
tm1637.display(3,analogRead(A0) % 10); //Display of units
Serial.print( analogRead(A0) ); // Show the value of A0 on the serial port
Serial.println("");
t = millis();
}
}
Par contre que signifie le "% 10" ??