Outils pour utilisateurs

Outils du site


hardware:wsks:notes-install

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
hardware:wsks:notes-install [2021/01/07 21:55] – [Montage du capteur DHT11] yoannhardware:wsks:notes-install [2021/02/01 21:51] (Version actuelle) – modification externe 127.0.0.1
Ligne 166: Ligne 166:
 SCL -> D1 SCL -> D1
 SDA -> D2 SDA -> D2
 +
 +===== Montage capteur de luminosité =====
 +
 +^ Devkit        ^ BH1750FVI  |
 +| 3V            | VCC        |
 +| D1            | SCL        |
 +| D2            | SDA        |
 +| G             | GND        |
 +
 +
 +<code c test_BH1750FVI.ino>
 +#include <Wire.h>
 +
 +const int Light_ADDR = 0b0100011;   // address:0x23
 +
 +int tempLight = 0;
 +
 +void readLight();
 +
 +void setup() {
 +   Serial.begin(115200);
 +
 +  Wire.begin();
 +
 +  //initialize light sensor
 +  Wire.beginTransmission(Light_ADDR);
 +  Wire.write(0b00000001);
 +  Wire.endTransmission();
 +
 +}
 +
 +void loop() {
 +  readLight();
 +  delay(5000);
 +}
 +
 +void readLight(){
 +  // reset
 +  Wire.beginTransmission(Light_ADDR);
 +  Wire.write(0b00000111);
 +  Wire.endTransmission();
 +
 +  Wire.beginTransmission(Light_ADDR);
 +  Wire.write(0b00100000);
 +  Wire.endTransmission();
 +  // typical read delay 120ms
 +  delay(120);
 +  Wire.requestFrom(Light_ADDR, 2); // 2byte every time
 +  for (tempLight = 0; Wire.available() >= 1; ) {
 +    char c = Wire.read();
 +    tempLight = (tempLight << 8) + (c & 0xFF);
 +  }
 +  tempLight = tempLight / 1.2;
 +  Serial.print("light: ");
 +  Serial.println(tempLight);
 +}
 +</code>
 +
 +===== Montage de l'écran OLED =====
 +
 +^ DevKit  ^ OLED   |
 +| 3V      | Vcc    |
 +| G       | GND    |
 +| D1      | SCL    |
 +| D2      | SDA    |
 +
  
 ===== Références ===== ===== Références =====
hardware/wsks/notes-install.1610056534.txt.gz · Dernière modification : 2021/02/01 21:51 (modification externe)