Wednesday, September 18, 2019

Cindy - PM - 90 MINS

MY ROBOT PROJECT: Tardis Telephone Booth

Today in open lab, I worked on my code. At first, I was having trouble since I was confused on how to start the code. Once I got it started and ran my code, there were errors. My numbers would go up to 255 and then start going back down. "Ending Main Code Loop" kept on printing after every line, but Mr. Burnham helped me get through the code. I started to understand the format of coding. This was the code that I wrote:

// ============================================================================
const int arduinoBoardLED = 13; // LED on pin 13

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);               // Use Serial Monitor to debug
  pinMode(arduinoBoardLED, OUTPUT); // initialize the digital pin as an output.
  Serial.println("Running The Setup Function");
}

void loop() {
  // put your main code here, to run repeatedly
  delay(1000); // just a small delay to slow the main loop down
  Serial.println("Starting Main Loop Code");
  // put your code between here
  int x = 1;
  for (int i = 0; i < 20; i = i + x) {
   Serial.println(i); 
    if (i == 7) {
      //x = -1;  // switch direction at peak
      Serial.println("hi 7"); 
    }
    delay(50);   

  // and here
  
}
Serial.println("Ending Main Loop Code");

}

No comments:

Post a Comment