Hello Everyone,
I am new to ESP32 and ESP Rainmaker world. I was wondering if there is any example code for digital and analog data read using ESP Rainmaker.
If there is no example available then any suggestion on how to accomplish such operations?
Best Regards,
Ifthekhar
Digital and analog I/O read
-
- Posts: 307
- Joined: Wed Feb 20, 2019 7:02 am
Re: Digital and analog I/O read
Hello,
There is not any specific example as such, but you can integrate any espi-idf example (say the gpio example) with RainMaker. Digital I/Os will mostly map to some boolean parameter, whereas analog I/Os will map to integer/float parameters
Regards,
Piyush
There is not any specific example as such, but you can integrate any espi-idf example (say the gpio example) with RainMaker. Digital I/Os will mostly map to some boolean parameter, whereas analog I/Os will map to integer/float parameters
Regards,
Piyush
Re: Digital and analog I/O read
Hello @ESP_Piyush, Thank you for your reply. I am completely new to this platform. So some of the stuff looks a bit difficult to understand for me. It looks like there are two .c files in the main folder. Please correct me if I'm wrong, the "app_driver.c" works on the board or peripheral level to initialize the pins and establish communication protocols, and the "app_main.c" is for the app interface of the mobile application.
Is there a tutorial on how to declare and implement the peripheral declaration on the "app_driver.c" file and how to make it communicate with the "app_main.c" file. So that when I declare something in the "app_driver.c" file it gets recognized by the "app_main.c" file? In a way how to transfer data from one file to another to make the program work.
For Example:
If I want to perform a continuous analog read say from pin 34 of an ESP32 board(On top of my mind, I think it is from ADC1), I need to declare them in the "app_driver.c" file first, and then somehow I need to tell the "app_main.c" file that it should read the data from there and show it to the android application. I was wondering where there is any tutorial on how to do that? If not then do you have any suggestion for a nube?
Best Regards,
Ifthekhar
Is there a tutorial on how to declare and implement the peripheral declaration on the "app_driver.c" file and how to make it communicate with the "app_main.c" file. So that when I declare something in the "app_driver.c" file it gets recognized by the "app_main.c" file? In a way how to transfer data from one file to another to make the program work.
For Example:
If I want to perform a continuous analog read say from pin 34 of an ESP32 board(On top of my mind, I think it is from ADC1), I need to declare them in the "app_driver.c" file first, and then somehow I need to tell the "app_main.c" file that it should read the data from there and show it to the android application. I was wondering where there is any tutorial on how to do that? If not then do you have any suggestion for a nube?
Best Regards,
Ifthekhar
-
- Posts: 307
- Joined: Wed Feb 20, 2019 7:02 am
Re: Digital and analog I/O read
You can check out any of the examples in ESP RainMaker. Let me give some more information based on switch example in particular. It demonstrates a switch device with a controllable boolean parameter named "Power". The device has a write callback registered. Whenever the device gets some request via the ESP RainMaker cloud, this callback gets invoked and it writes to the hardware using the app_driver_set_state() API. This API is declared in app_prov.h and defined in app_driver.c here. This completes the cloud to device control. The device then also reports the new state to the cloud here.
Now, if any local change happen on the device, which in this case is change in switch power state using push button, the driver code reports the new value to the cloud using esp_rmaker_param_update_and_report() from app_driver.c. In your case, this would be periodic update like you can find in the temperature_sensor example.
Now, if any local change happen on the device, which in this case is change in switch power state using push button, the driver code reports the new value to the cloud using esp_rmaker_param_update_and_report() from app_driver.c. In your case, this would be periodic update like you can find in the temperature_sensor example.
Re: Digital and analog I/O read
Thank you, Piyush. That's a start for me. I'll keep looking into it. If I face any other issue on the same topic, I will post it in this thread.
Best Regards,
Ifthekhar
Best Regards,
Ifthekhar
Who is online
Users browsing this forum: No registered users and 70 guests