Closed TBWXY777 closed 1 year ago
Hello, nice to meet you!
I'm curious, what are you building?
Re DHT22 - you'll have to implement the protocol. Since the protocol is timing sensitive, I suggest to wait a bit until I have a chance to push the clock changes for wokwi/wokwi-features#186 (see my comment here).
Another way to go about this would be to read the symbols from the ELF file, intercept the calls to readHumidity()
and readTemperature()
, and return a fake value instead of calling the actual code. You could do it by replacing the blTaken() hook with your own implementation that would compare the PC
value with the symbol you read from the ELF file, and in case of a match will put the return value in the relevant register (r0, if I'm not wrong), and update PC with the value of LR to immediately return from the call.
Hello, nice to meet you!
I'm curious, what are you building?
Re DHT22 - you'll have to implement the protocol. Since the protocol is timing sensitive, I suggest to wait a bit until I have a chance to push the clock changes for wokwi/wokwi-features#186 (see my comment here).
Another way to go about this would be to read the symbols from the ELF file, intercept the calls to
readHumidity()
andreadTemperature()
, and return a fake value instead of calling the actual code. You could do it by replacing the blTaken() hook with your own implementation that would compare thePC
value with the symbol you read from the ELF file, and in case of a match will put the return value in the relevant register (r0, if I'm not wrong), and update PC with the value of LR to immediately return from the call.
I am glad to receive your reply. I am not building anything, I am just curious about the components of wokwi-elements. Recently, I successfully simulated the interaction between LCD1602 and PICO of wokwi-elements, which I found very interesting. Therefore, I want to try simulating DHT22. However, simulating DHT22 is a bit difficult for a beginner like me. Your suggestions have given me a lot of inspiration. Thank you very much.
Good luck!
Hi, I am trying to use the DHT22 temperature and humidity sensor with RP2040, and I want to simulate the sensor. I am hoping to find some guidance on how to simulate the DHT22 sensor and use it with RP2040 to read temperature and humidity. I have attached my current Arduino code below:
I have seen DHT22 on both wokwi-elements and the Wokwi platform, but I am not sure how it interacts with RP2040. Thank you very much for your help!