ESP32 code coded into micropython

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Jackli
Posts: 80
Joined: Thu Apr 29, 2021 9:11 am

ESP32 code coded into micropython

Post by Jackli » Thu Jul 22, 2021 9:56 am

I saw a weather station project done online using ESP microcontroller and TFT LCD, but he was using Arduino to program ESP32, I now want to port it to Raspberry Pi, but the code of ESP32 is not very comprehensive given.
Here is the code as far as I can see.
Image

Code: Select all

if(Serial.available() != 0)

  {

    for(cout_i = 0; cout_i < 9; cout_i ++)

    {

        RecievedTemp[cout_i] = Serial.read();

    }

    switch(RecievedTemp[5])

    {

    case 0x0D://Temperature start

        TemperatureBool = true;

        break;

    case 0x0E://Temperature stop

        TemperatureBool = false;

        TemperatureOutput[6] = 0;

        TemperatureOutput[7] = 0;

        Serial.write(TemperatureOutput, 8);

        break;

    case 0x0F://Temperature back

        TemperatureBool = false;

        break;

    case 0x11://Humidity start

      HumidityBool = true;

        break;

    case 0x12://Humidity stop

        HumidityBool = false;

        HumidityValue = 0;

        HumidityOutput[7] = HumidityValue;

        Serial.write(HumidityOutput, 8);

        break;

    case 0x10://Humidity back

        HumidityBool = false;

        break;

    case 0x14://illumination start

      illuminationBool = true;

      illuminationState = false;

        break;

williamhenrick
Posts: 16
Joined: Wed Jul 14, 2021 8:58 am

Re: ESP32 code coded into micropython

Post by williamhenrick » Thu Jul 22, 2021 10:53 pm

You won't find a way to convert the code from Arduino to Raspberry Pi, I think that's what you are trying to do.

Instead, you should understand the Arduino code, the algorithm, and then design your own code for Pi.

Post Reply