Path to “Magic button” S01E01

This is the code to blink a LED on a GPIO on an ESP8266-1 loaded with NodeMCU. What is of particular interest is the GPIO0 and GPIO2 values.

GPIO0=3
GPIO2=4

pin = GPIO0
gpio.mode(pin, gpio.OUTPUT)

lighton=0
tmr.alarm(0,1000,1,function()
    if lighton==0 then 
        lighton=1
        gpio.write(pin, gpio.HIGH)
        -- 512/1024, 50% duty cycle
    else 
        lighton=0 
        gpio.write(pin, gpio.LOW)
    end 
    print(lighton)
end)

Connecting BugOne and Raspberry Pi

I challenged a friend to connect a micro-controller to a Raspberry Pi. I chose to use an ATMega168 programmed in C while he preferred to use a Microchip PIC programmed in ASM. Not that I don’t like ASM, but it took me only 45 minutes to get all the material together and blink some LEDs from a shell. To get thinks up very fast, I used a BugOne board. This is clearly an advantage for me since it is already assembled with an ISP connector and ready to use.

Continue reading “Connecting BugOne and Raspberry Pi”