2023年6月1日木曜日

Pico デュアルコア テスト(Arduino IDE)

Raspberry Pi PicoをArduino IDEを使ってデュアルコアのテストを行いました。
●こちらのサイトをもとに各コア動作を2個のLED点滅に変更。【https://rikoubou.hatenablog.com/entry/2022/09/08/153621
抵抗入りLEDをGPIO20.21に入れる。







シリアルモニター

●Arduino IDEによるデュアルコアスケッチ
【コア1】スケッチ
  void setup()
   |
  void loop() 
   |
【コア2】スケッチ
  void setup1()
   |
  void loop1()
   |

●プログラムの流れ
【コア1】[LED赤]を点滅毎に[count]+1
 [シリアルモニタ]に[count]送信。
【コア2】[LED緑]を点滅毎に[count]+10






プログラム Arduino IDE【ボード:Raspberry Pi Pico】
const int LedR_PIN = 20;
const int LedG_PIN = 21;
int count = 0;
bool ledR_flg = true;
bool ledG_flg = true;
 
/* ---- Core 0の処理 ---- */
void setup() {
  pinMode(LedR_PIN, OUTPUT);
  Serial.begin(115200);
  delay(500);
  Serial.println("core0:start....");
}

void loop() {
  digitalWrite(LedR_PIN, ledR_flg);
  ledR_flg = !ledR_flg;
  Serial.println(count);
  count = count + 1;

  if (count > 100) {
    count = 0;
  }
  delay(500);
}

/* ---- Core 1の処理 ---- */
void setup1() {
  pinMode(LedG_PIN, OUTPUT);
  delay(500);
  Serial.println("core1:start....");
}

void loop1() {
  count = count + 10;
  digitalWrite(LedG_PIN, ledG_flg);
  ledG_flg = !ledG_flg;
  delay(1000);
}

0 件のコメント:

コメントを投稿

Pi Pico PIO 90度位相差 クロック - AM放送 受信テスト

 Pi Pico Rx - 公開プログラムnco_pioを使い、Raspberry Pi Pico (RP2040) PIO制御による90度位相差クロック530~1600KHzの局発I Qを直交ミキサに入力、出力IQ信号をZEPエンジニアリング株式会社公開 【 5_PicoSta...