Initial experience with Raspberry PICO

Created at 2021-12-23 21:05:54

I've got mine PICO board and followed succesfully tutorial: https://rt-thread.medium.com/getting-started-with-raspberry-pi-pico-in-rt-thread-studio-ide-5bb08c01363f. But for me it would be wonderful to have the IDE RT-Thread-Studio running on a greater brother of PICO - the Raspberry PI4 under Linux but there is no Linux version yet. I also consider porting my old code written in Arduino to RT-Thread.
So simplest Arduino code:

void setup() {
// initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_PIN, OUTPUT);
  }
// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage 
  level)
  delay(1000); // wait for a second
  digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage 
  LOW
  delay(1000); // wait for a second
}
I translated into RT-Thread version:
while (1)
{
    rt_pin_write(LED_PIN, 1);
    rt_thread_mdelay(1000);
    rt_pin_write(LED_PIN, 0);
    rt_thread_mdelay(1000);
}
Also original PICO Raspberry SDK example from [http://github.com/raspberrypi/pico-examples/blob/master/blink/blink.c] (http://github.com/raspberrypi/pico-examples/blob/master/blink/blink.c) 

include "pico/stdlib.h"
int main() {
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while (true) {
    gpio_put(LED_PIN, 1);
    sleep_ms(250);
    gpio_put(LED_PIN, 0);
    sleep_ms(250);
}

}

can be easily ported as well.
I consider to write a simple script or Python code to automatic translate my big Arduino project codebase to RT-Thread. Anyone knows of that kind of project?

1 Answer

Create
Post