Page 4 sur 4
Re: Montages ESP32 S3 WROOM
Posté : 07 sept. 2026, 17:05
par clbesson
Re: Montages ESP32 S3 WROOM
Posté : 09 sept. 2026, 11:04
par Clem68

à vous
Je suppose que l'on peut faire des mélages teintes avec les couleur entre-elles (en jouant sur 2 ou les 3 potars.
Exact, oui c'est possible.
Exercice: N°11.3
Contrôler un module RGB avec un potentiomètre
ex 11.3.jpg
Le sketch:
Code : Tout sélectionner
/**********************************************************************
Filename : SoftRainbowLight
Description : Make the strip light up in rainbow colors.
Auther : www.freenove.com
Modification: 2024/06/18
**********************************************************************/
#include "Freenove_WS2812_Lib_for_ESP32.h"
#define PIN_POT 1 // Define analog input pins
#define LEDS_COUNT 8 // The number of led
#define LEDS_PIN 14 // define the pin connected to the Freenove 8 led strip
#define CHANNEL 0 // RMT module channel
#define BRIGHTNESS 20 // breghtness, the value range is 0-255.
Freenove_ESP32_WS2812 strip = Freenove_ESP32_WS2812(LEDS_COUNT, LEDS_PIN, CHANNEL, TYPE_GRB);
void setup() {
strip.setBrightness(BRIGHTNESS);
strip.begin();
}
void loop () {
int colorPos=map(analogRead(PIN_POT), 0, 4095, 0, 255); for (int i= 0;i<
LEDS_COUNT;i++){
strip.setLedColorData(i,strip.Wheel(colorPos + i * 255 / 8));
}strip.show(); // Send color data to LED, and display.
delay(10);
}
@+
Re: Montages ESP32 S3 WROOM
Posté : 09 sept. 2026, 11:16
par C2Vues-BricoTrain
Re: Montages ESP32 S3 WROOM
Posté : 09 sept. 2026, 11:41
par likiki
Re: Montages ESP32 S3 WROOM
Posté : 10 sept. 2026, 22:35
par Clem68

à vous!
Exercice: N°12
Contrôler luminosité avec une photorésistance
1 résistance 220 Ohm
1 résistance 1 ko
ex 12.jpg
Le sketch:
Code : Tout sélectionner
/**********************************************************************
Filename : NightLamp
Description : Controlling the brightness of LED by photoresistor.
Auther : www.freenove.com
Modification: 2024/06/18
**********************************************************************/
#define PIN_ANALOG_IN 1
#define PIN_LED 14
#define CHAN 0
#define LIGHT_MIN 372
#define LIGHT_MAX 2048
void setup() {
ledcAttachChannel(PIN_LED, 1000, 12, CHAN);
}
void loop() {
int adcVal = analogRead(PIN_ANALOG_IN); //read adc
int pwmVal = map(constrain(adcVal, LIGHT_MIN, LIGHT_MAX), LIGHT_MIN, LIGHT_MAX, 0, 4095); // adcVal re-map to pwmVal
ledcWrite(PIN_LED, pwmVal); // set the pulse width.
delay(10);
}
Dans la vidéo on a un peu de mal à distinguer le changement de luminosité.
@+
Re: Montages ESP32 S3 WROOM
Posté : 11 sept. 2026, 06:44
par likiki
Re: Montages ESP32 S3 WROOM
Posté : 11 sept. 2026, 10:13
par C2Vues-BricoTrain
Petite info (qui peut être utile...) :
Quand j'ai filmé avec mon téléphone les essais de luminosité avec changements de couleurs sur une led tricolore, je mettais un morceau de feuille blanche dessus (ou un morceau de calque légèrement opaque qui servait de filtre, genre papier de soie ou de cuisson...), ce qui faisait que mon appareil restituait correctement les variantes progressives de couleurs et non plus parasité par un éclairage permanent "blanc" d'apparence... (mais on ne voyait plus la led)
Ou alors, il faudrait trouver une sorte de cabochon à mettre dessus pour éviter d'avoir ce désagrément visuel dans les vidéos...
(Ce n'est qu'une observation de ma part que je partage avec vous...)
Re: Montages ESP32 S3 WROOM
Posté : 12 sept. 2026, 22:30
par Clem68

à vous
Fernando
Idée à retenir
Exercice: N°13
Contrôle de la température avec une thermistance
1 résistance de 10 ko
ex13.jpg
Le sketch:
Code : Tout sélectionner
/**********************************************************************
Filename : Thermomter
Description : Making a thermometer by thermistor.
Auther : www.freenove.com
Modification: 2024/06/19
**********************************************************************/
#define PIN_ANALOG_IN 1
void setup() {
Serial.begin(115200);
}
void loop() {
int adcValue = analogRead(PIN_ANALOG_IN); //read ADC pin
double voltage = (float)adcValue / 4095.0 * 3.3; // calculate voltage
double Rt = 10 * voltage / (3.3 - voltage); //calculate resistance value of thermistor
double tempK = 1 / (1 / (273.15 + 25) + log(Rt / 10) / 3950.0); //calculate temperature (Kelvin)
double tempC = tempK - 273.15; //calculate temperature (Celsius)
Serial.printf("ADC value : %d,\tVoltage : %.2fV, \tTemperature : %.2fC\n", adcValue, voltage, tempC);
delay(1000);
}
Voir les valeurs sur le moniteur série
@+
Re: Montages ESP32 S3 WROOM
Posté : 13 sept. 2026, 08:10
par likiki
Re: Montages ESP32 S3 WROOM
Posté : 14 sept. 2026, 17:40
par Clem68
Exercice: N°14
Lecture des données de sortie d'un joystick
ex14.jpg
Le sketch:
Code : Tout sélectionner
/**********************************************************************
Filename : Joystick
Description : Read data from joystick.
Auther : www.freenove.com
Modification: 2024/06/19
**********************************************************************/
int xyzPins[] = {14, 13, 12}; //x,y,z pins
void setup() {
Serial.begin(115200);
pinMode(xyzPins[2], INPUT_PULLUP); //z axis is a button.
}
void loop() {
int xVal = analogRead(xyzPins[0]);
int yVal = analogRead(xyzPins[1]);
int zVal = digitalRead(xyzPins[2]);
Serial.printf("X,Y,Z: %d,\t%d,\t%d\n", xVal, yVal, zVal);
delay(500);
}
Voir les valeurs sur le moniteur série
@+
Re: Montages ESP32 S3 WROOM
Posté : 14 sept. 2026, 19:42
par likiki
Re: Montages ESP32 S3 WROOM
Posté : 15 sept. 2026, 22:04
par Clem68
Exercice: N°15
Lumière à effet d'eau courante avec une puce: IC 74HC595
8 résistances 220 Ohms
ex15.jpg
Le sketch:
Code : Tout sélectionner
/**********************************************************************
Filename : FlowingLight02
Description : Use 74HC575 to drive the ledbar to display the flowing light.
Auther : www.freenove.com
Modification: 2024/06/19
**********************************************************************/
int latchPin = 13; // Pin connected to ST_CP of 74HC595(Pin12)
int clockPin = 14; // Pin connected to SH_CP of 74HC595(Pin11)
int dataPin = 12; // Pin connected to DS of 74HC595(Pin14)
void setup() {
// set pins to output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
// Define a one-byte variable to use the 8 bits to represent the state of 8 LEDs of LED bar graph.
// This variable is assigned to 0x01, that is binary 00000001, which indicates only one LED light on.
byte x = 0x01; // 0b 0000 0001
for (int j = 0; j < 8; j++) { // Let led light up from right to left
writeTo595(LSBFIRST, x);
x <<= 1; // make the variable move one bit to left once, then the bright LED move one step to the left once.
delay(50);
}
delay(1000);
x = 0x80; //0b 1000 0000
for (int j = 0; j < 8; j++) { // Let led light up from left to right
writeTo595(LSBFIRST, x);
x >>= 1;
delay(50);
}
delay(1000);
}
void writeTo595(int order, byte _data ) {
// Output low level to latchPin
digitalWrite(latchPin, LOW);
// Send serial data to 74HC595
shiftOut(dataPin, clockPin, order, _data);
// Output high level to latchPin, and 74HC595 will update the data to the parallel output port.
digitalWrite(latchPin, HIGH);
}
A partir du prochain exercice je limiterai les câbles Dupont et remplacerai par du rigide. Cela diminuera les faux contacts. Dans la vidéo je suis obligé d'appuyer sur le paquet de fils.
@+
Re: Montages ESP32 S3 WROOM
Posté : 16 sept. 2026, 07:56
par likiki
Re: Montages ESP32 S3 WROOM
Posté : 17 sept. 2026, 10:47
par clbesson