0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

STM32F767でKnight Rider(ナイトライダー)で遊ぶ

Last updated at Posted at 2023-05-16

x 過去ログを見よ

D0からD7まで

o_cop526.jpg





//GPIO_Knight_Rider1_test_767_1

#define DW digitalWrite 


void GPIO_D0_D7(int s)
{

  digitalWrite(7, (s>>7) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(6, (s>>6) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(5, (s>>5) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(4, (s>>4) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(3, (s>>3) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(2, (s>>2) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(1, (s>>1) & 0x01);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(0, s & 0x01);       // turn the LED on (HIGH is the voltage level)
  
} //GPIO_D0_D7


void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(PB7, OUTPUT);
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);


} //setup

void loop() {

  digitalWrite(PB7, HIGH);   // turn the LED on (HIGH is the voltage level)
  GPIO_D0_D7(0x01);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, LOW);    // turn the LED off by making the voltage LOW
  GPIO_D0_D7(0x02);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, HIGH);   // turn the LED on (HIGH is the voltage level)
  GPIO_D0_D7(0x04);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, LOW);    // turn the LED off by making the voltage LOW
  GPIO_D0_D7(0x08);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, HIGH);   // turn the LED on (HIGH is the voltage level)
  GPIO_D0_D7(0x10);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, LOW);    // turn the LED off by making the voltage LOW
  GPIO_D0_D7(0x20);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, HIGH);   // turn the LED on (HIGH is the voltage level)
  GPIO_D0_D7(0x40);

  delay(1000);                       // wait for a second

  digitalWrite(PB7, LOW);    // turn the LED off by making the voltage LOW
  GPIO_D0_D7(0x80);

  delay(1000);                       // wait for a second



} //loop



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?