Affordable and flexible platform to ease prototyping using a STM32L152RET6 microcontroller.

photocell

17 Dec 2016

Hi,

I'm looking for a code for a photoresistor that turns a led, who can help me ?

thank you.

13 Feb 2018

Hi,

I try this on my STM32L152RE and it's working

  1. include "mbed.h"

AnalogIn Lumiere(A0); DigitalOut LED(PB_9);

int main() { déclaration des valiables pour les mesures analogiques float Lum_r; float Lum_v;

while(1) { Lum_r = Lumiere.read(); lis la valeur de luminosite (value from 0.0 to 1.0 = full ADC conversion range) Lum_v = Lum_r * 3300; convertis la valeur sur plage de 0V-3.3V printf("luminosite a %.0f \n", Lum_v); if (Lum_v > 2500){ LED = 1; }else{ LED =0; } wait (1); } } fin du programme

07 Mar 2018

/media/uploads/juan131210/ldr.png