Juan Moreno
/
SmartLights
Proyect
Main/main.cpp@0:8e048063034d, 2019-07-05 (annotated)
- Committer:
- junmorenodi
- Date:
- Fri Jul 05 13:36:32 2019 +0000
- Revision:
- 0:8e048063034d
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
junmorenodi | 0:8e048063034d | 1 | #include "mbed.h" |
junmorenodi | 0:8e048063034d | 2 | #include "BH1750.h" |
junmorenodi | 0:8e048063034d | 3 | |
junmorenodi | 0:8e048063034d | 4 | //BH1750 lightSensor(I2C_SDA, I2C_SCL); |
junmorenodi | 0:8e048063034d | 5 | BH1750 lightSensor(PB_9, PB_8); |
junmorenodi | 0:8e048063034d | 6 | Serial pc(SERIAL_TX, SERIAL_RX); |
junmorenodi | 0:8e048063034d | 7 | |
junmorenodi | 0:8e048063034d | 8 | //PwmOut mypwm1(PC_8); |
junmorenodi | 0:8e048063034d | 9 | |
junmorenodi | 0:8e048063034d | 10 | int main() |
junmorenodi | 0:8e048063034d | 11 | { |
junmorenodi | 0:8e048063034d | 12 | lightSensor.init(); |
junmorenodi | 0:8e048063034d | 13 | |
junmorenodi | 0:8e048063034d | 14 | // mypwm1.period_ms(10); |
junmorenodi | 0:8e048063034d | 15 | // mypwm1.pulsewidth_ms(5); |
junmorenodi | 0:8e048063034d | 16 | |
junmorenodi | 0:8e048063034d | 17 | while(1) { |
junmorenodi | 0:8e048063034d | 18 | pc.printf("Light intensity: %.4f Lux\r\n", lightSensor.readIntesity()); |
junmorenodi | 0:8e048063034d | 19 | wait(5); |
junmorenodi | 0:8e048063034d | 20 | } |
junmorenodi | 0:8e048063034d | 21 | } |