Page 1 of 1

ESP32 code coded into micropython

Posted: Thu Jul 22, 2021 9:56 am
by Jackli
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;

Re: ESP32 code coded into micropython

Posted: Thu Jul 22, 2021 10:53 pm
by williamhenrick
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.