A probléma a következő, Adott egy arduino pro mini ( 3.3V 8MHz) és egy BH1750 I2CV -s fénymérő.
az arduinot a LowPower.h segítségével lekapcsolom, amit gyönyörűen meg is tesz. Viszont ha a fénymérőnek is azt mondom hogy 1 méréses módi és közben szunya akkor sajna csak 1x mér jó értéket utána nem... Persze ha nem ilyen módban van hanem folyamatos mérésben akkor mér annak ellenére is hogy powerdown módban le tudom küldeni a procit, feléledés után meg szépen kérdez.
https://github.com/mickley/Arduino-BH1750FVI ezzel a libbel próbálom a fénymérőt
http://cpre.kmutnb.ac.th/esl/learning/b ... asheet.pdf BH1750 adatlapja
Kód: Egész kijelölése
// **** INCLUDES *****
/*
Example of BH1750 library usage.
This example initalises the BH1750 object using the default
high resolution mode and then makes a light level reading every second.
Connection:
VCC-5v
GND-GND
SCL-SCL(analog pin 5)
SDA-SDA(analog pin 4)
ADD-NC or GND
*/
#include <Wire.h>
#include <BH1750FVI.h>
#include "LowPower.h"
BH1750FVI LightSensor;
void setup()
{
digitalWrite( SDA, LOW);
digitalWrite( SCL, LOW);
Serial.begin(9600);
/* Full mode list:
##### I2C Addresses #####
Addr_LOW 0x23 // Device address when address pin LOW
Addr_HIGH 0x5C // Device address when address pin High
##### Modes #####
Continuous_H - 1 lx resolution (16 bit), 120ms sampling time
Continuous_H2 - 0.5 lx resolution (18 bit), 120ms sampling time
Continuous_L - 4 lx resolution (15 bit), 16ms sampling time
OneTime_H
OneTime_H2
OneTime_L
Default for Begin() is Addr_LOW and Continuous_H
*/
LightSensor.Begin(OneTime_L);
Serial.println("Running...");
}
void loop()
{
// Enter power down state for 8 s with ADC and BOD module disabled
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
// LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF,
// SPI_OFF, USART0_OFF, TWI_OFF);
float lux = LightSensor.GetLux();// Get Lux value
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lx");
delay (2000);
// Do something here
// Example: Read sensor, data logging, data transmission.
}
Segítségeteket előre is köszönöm!