[06.) BLOG POST: INPUT/OUTPUT (INTERACTIVE OBJECT)]

 

                                             https://youtu.be/ANPTbi9osF4

This work comes from a story in ancient China, which took place during the Shang and Zhou periods of history and legend. King Zhou of Shang was tyrannical and King Wen of Zhou was determined to overthrow the tyranny. Tai Gong Jiang Ziya was ordered by his master to go down to the world to help King Wen. But Jiang Ziya felt that he was half a hundred years old and had no friendship with King Wen, so it was difficult for him to gain his appreciation. So on his way back to the capital, he fished on the side of the river with a straight hook without bait. The hook was curved, but Jiang Ziya used a straight hook (which could not be called a hook) without bait. When King Wen saw it, he thought it was a strange man, so he took the initiative to talk to him and found it was a really useful talent, so he recruited him into his tent. Later, Jiang Ziya helped King Wen and his son overthrow King Zhou of the Shang Dynasty and established the Zhou Dynasty.

The Jiang Ziya in the story seems to be fishing with a fishing rod without bait, but in fact this act of his is the bait, and this fish is not literally a fish, the fish that Jiang Ziya is waiting for is actually King Wen of Zhou. People who have played this fishing device of mine actually know that it is actually very difficult to adjust the line to accurately catch l to fish, because y fish are so fast. But if the line is placed in a fixed place to wait for the fish, it will be very simple. The truth contained in this is actually the same as in the story.

This was a required text we learned in elementary school. After the adaptation of this story I replaced the ginger with a cat. I also remember a quote from Brian that also inspired me. In fact we all played with a fishing toy with magnets when we were kids. But in China we weren't allowed to bring toys into school, so we would make our own toys at school out of unused paper or cardboard. Although Bryan offered me to make the pieces more complete and colorful in appearance. But I think the rough cardboard shells and tape and the story reflect my childhood.

                          

https://youtu.be/sqDJW75TaLc


<textarea>#include <Servo.h>


const int BUTTON_PIN = 7; 
const int SERVO_PIN  = 9; 

Servo servo; 
Servo servo2;

int angle = 0;          
int lastButtonState;    
int currentButtonState; 

void setup() {
  Serial.begin(9600);                
  pinMode(BUTTON_PIN, INPUT_PULLUP); 
  servo.attach(SERVO_PIN);           
  servo.write(angle);
  currentButtonState = digitalRead(BUTTON_PIN);

  servo2.attach(12);
  servo2.write(90);
}

void loop() {
    
    servo2.write(45);
    
  
  
  lastButtonState    = currentButtonState;     
  currentButtonState = digitalRead(BUTTON_PIN); 

  if(lastButtonState == HIGH && currentButtonState == LOW) {
    Serial.println("The button is pressed");

   
    if(angle == 0)
      angle = 90;
    else
    if(angle == 90)
      angle = 0;

    
    servo.write(angle);
    
    
    
  }

}</textarea>



评论

此博客中的热门博文

A5OBDF310

OBDF310A3

OBDF310A4