Sunday, April 24, 2022

Draw Turkey flag with python turtle

 Code:



from turtle import*

setup(800,500)

speed(5)

penup()

goto(-400, 250)

pendown()

 

color("red")

begin_fill()

for n in range(2):

    forward(800)

    right(90)

    forward(500)

    right(90)

end_fill()

 

penup()

goto(-50, 0)

 

penup()

backward(75)

left(90)

forward(125)

left(90)

pendown()

 

color("white")

begin_fill()

circle(127.5)

end_fill()

 

penup()

goto(-87, 105.5)

pendown()

 

color("red")

begin_fill()

circle(107)

end_fill()

 

penup()

color("white")

goto(50, -35)

right(20)

begin_fill()

for x in range(5):

    forward(100)

    right(144)

end_fill()

 

penup()

goto(350, -255)

right(154)

color("white")


Create pictures with the CHAR function in Google Sheets

Saturday, April 16, 2022

ESP32 Capacitive Touch Sensor Pins with microPython | Touch Sensitive LED

The ESP32 provides up to 10 capacitive sensing GPIOs.
These GPIOs can detect variations in anything that contains an electrical charge, such as human skin. They can thus detect the variations induced when touching the GPIOs with a finger.

Comment utiliser les broches tactiles ESP32 avec MicroPython?


Code1:
from machine import Pin, TouchPad
from time import sleep

touch=TouchPad(Pin(4))
while True:
    print(touch.read())
    sleep(0.5)
    
Code2:
from machine import Pin, TouchPad
from time import sleep

touch=TouchPad(Pin(4))
led=Pin(16,Pin.OUT)

touch.config(300)

while True:
    if touch.read()<=300:
        led.value(not led.value())
    sleep(0.5)