Search found 13 matches

by kpin404
Tue Aug 03, 2021 4:16 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

I have not needed to use it and therefore in no position to advise you. I have read through Peter's tutorial in preparation for the day that I might need to use it. I think it would be fairly easy to do a simple application like yours. I would expect a simple example like yours in a tutorial. Stand...
by kpin404
Tue Aug 03, 2021 3:39 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

davef wrote:
Tue Aug 03, 2021 3:32 am
I see I mis-understood your original posting. I thought that you could not get the LED to blink at all, but could get temp and humidity readings.

Sorry, for creating more confusion.
Its okay! No problem at all. Could you please let me assist how to use uasyncio to code for this? Thanking you.
by kpin404
Tue Aug 03, 2021 3:28 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

davef wrote:
Tue Aug 03, 2021 3:18 am
Your code says to turn the LED on for 0.5 seconds and off for 3.5 seconds
Okay! Go it.
by kpin404
Tue Aug 03, 2021 2:41 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

I have modify the code: from machine import Pin from time import sleep led = Pin(2, Pin.OUT) sensor = dht.DHT22(Pin(14)) while True: led.on() print('LED on') time.sleep(0.5) led.off() print('LED off') time.sleep(0.5) sensor.measure() print('Temperature = %.2f' % sensor.temperature()) print('Humidity...
by kpin404
Tue Aug 03, 2021 2:26 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

OK about the IDE. I just use the command line so didn't recognise what was happening. So, back to my earlier comment about removing the DTH22 stuff and just focusing on getting the LED to work. from machine import Pin from time import sleep led = Pin(2, Pin.OUT) while True: led.on() print('LED on')...
by kpin404
Mon Aug 02, 2021 12:07 pm
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

Firstly, sorry I see you do call sensor.temperature() and sensor.humidity() It looks you have another file called main.py. Better post that as I don't understand: Ready to download this file,please wait! ... download ok exec(open('./main.py').read(),globals()) I understand that you want both of the...
by kpin404
Mon Aug 02, 2021 9:03 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

I suggest to first try to understand why your simple bit of coding doesn't work. Does anything get printed out in repl when you use rshell? Does the LED blink? Comment out the lines: sensor.measure() print('Temperature = %.2f' % sensor.temperature()) print('Humidity = %.2f' % sensor.humidity()) sle...
by kpin404
Mon Aug 02, 2021 7:55 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

The best way to achieve concurrency is to use uasyncio. In addition to the official docs I have written a tutorial which you may find helpful. There is a significant learning curve, but it's well worthwhile. Thank you for keep assisting. Gone through your provided "uasyncio" tutorial and found to b...
by kpin404
Mon Aug 02, 2021 7:37 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

Re: LED blinking and DHT22 Sensor Codes

Using the code tags post the code you have. Are you trying to use uasyncio? Thank you for keep supporting. The code i am using: from machine import Pin from dht import DHT22 from time import sleep led = Pin(2, Pin.OUT) sensor = dht.DHT22(Pin(14)) while True: sensor.measure() print('Temperature = %....
by kpin404
Mon Aug 02, 2021 5:13 am
Forum: Programs, Libraries and Tools
Topic: LED blinking and DHT22 Sensor Codes
Replies: 20
Views: 6963

LED blinking and DHT22 Sensor Codes

I am learning Micropython codes on ESP32. I have learnt to code ESP32 how to blink an LED and measure Temperature and Humidity with DHT22 sensor with simple Micropython codes. Now i would like to combine these separate codes to blink an LED and measure sensor data at the same time within a code. I h...