Any explanation for this "weird" thing?!

 

 

Hi,

long time ago when i started learning electronics and while i was playing with microcontroller programming, i found out this strange behavior, i do not remember what exactly i was trying to do :D, anyway, i waill be glad if someone explains what is going on.

as you can see when i get my hand close to PORTB.3, the led switches on "see the code below".

 

Notes:

*this works only if you are using DC power supply.

*this will not work if your home suffers from power outage!!!

 

The code "ProtonBaisc":

Device = 16F628A

Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, BODEN_OFF, LVP_OFF, CP_OFF, MCLRE_ON, DATA_CP_OFF

Xtal = 4

Dim led As PORTB.4

Dim var1 As Word

 

Main:

PulsIn PORTB.3,1,var1

If var1 = 0 Then

Low led

GoTo Main

EndIf

 

High led 

GoTo Main

End

 

 

https://www.youtube.com/watch?v=_NFmtNEidyI

Thank you

thank you so much, this explains everything :slight_smile: