Reference no: EM133609705
Question: Find the code and send the video of adafruit circuit playground working. Please do not use FLORA. Use circuit playground.
Assignment: Test Code:
Note: Copy and paste this code into Arduino IDE. Make sure you delete all lines of code on your new sketch in Arduino IDE before pasting the code into Arduino IDE.
/*
Written by Brandon Watson for the AI & Arduino Coding Assignment in CTCH 110 Fall 2023 at the University of Regina.
The following code is designed to act as a check for whether you can successfully upload code to your Adafruit FLORA.
*/
#include<Adafruit_NeoPixel.h> // Include the NeoPixel library
#definePIN8 // Pick the pin on the FLORA that the LED is connected to (in this case, pin 8)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
voidsetup() {
strip.begin(); // Initialize the LED pixel
strip.show(); // Initialize the pixel to 'off'
}
voidloop() {
strip.setPixelColor(0, 0, 200, 100);
strip.show();
delay(500); //Delay for 500 miliseconds
strip.setPixelColor(0, 0, 0, 0);
strip.show();
delay(300); //Delay for 300 miliseconds
}
Assignment : Code for Assignment:
Note: Once you have been able to upload the test code to your FLORA, you can copy and past the assignment code into Arduino IDE and begin fixing it. This code wont upload so you will have to ask ChatGPT to help fix the code. Ask it to explain the code. For those of your who are new to coding, did this help? For those of you who have experience, was ChatGPT helpful?
/*
Written by Brandon Watson for the AI & Arduino Coding Assignment in CTCH 110 Fall 2023 at the University of Regina.
The following code is designed to blink the onboard led on an Adafruit FLORA in a certain sequence. The sequence is:
RED - for 1 second
OFF - for 2 seconds
Green - for 1 second
OFF - for 2 seconds
Blue - for 1 second
OFF - for 2 seconds
This sequence should repeat indefinitely.
*/
#include<Adafruit_NeoPixel.h>// Include the NeoPixel library
#definePIN8 // Pick the pin on the FLORA that the LED is connected to (in this case, pin 8)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
voidsetup() {
strip.begin() // Initialize the LED pixel
strip.show(); // Initialize the pixel to 'off'
}
voidloop() {
// first number = pixel number | second number = red brightness (0 - 255) | third number = green brightness (0 - 255) | fourth number = blue brightness (0 - 255)
// Example: strip.setPixelColor(pixel 1, Red, Green, Blue)
// Pixel 1 should be '0' because the count starts at 0
strip.setPixelColor(0, 255, 0, 100);
strip.show();
delay(3000); //Delay for 1000 miliseconds
strip.setPixelColor(0, 140, 100, 0);
strip.show();
delay(2000); //Delay for 2000 miliseconds
strip.setPixelColor(0, 0, 255, 0);
strip.show();
delay(500); //Delay for 1000 miliseconds
strip.setPixelColor(0, 0, 0, 0);
strip.show()
delay(10); //Delay for 2000 miliseconds
strip.setPixelColor(1, 0, 0, 255);
strip.show();
delay(1000); //Delay for 1000 miliseconds
strip.setPixelColor(0, 0, 0, 0);
strip.show();
delay(2000); //Delay for 2000 miliseconds
}
The correct LED sequence is:
RED - for 1 second
OFF - for 2 seconds
Green - for 1 second
OFF - for 2 seconds
Blue - for 1 second
OFF - for 2 seconds
Assignment Requirements:
- 300 - 500 word reflection on the process of using Al as a tool to learn and work with coding
- 3 screenshots of the process of fixing the code (ChatGPT, Arduino IDE)
- Your Final Code - add the text for your code directly to your portfolio along with your reflection
- a short video of your FLORA working
For those students using an Adafruit Circuit Playground instead of a FLORA, you will select the circuit playground board instead of the FLORA in Arduino IDE. If you upload the test code but the LED does not light up, you need to change the following line in both the test and assignment code.
#define PIN 8 // Pick the pin on the FLORA that the LED is connected to (in this case, pin 8)
#define PIN 17 // Pick the pin on the Circuit Playground that the LED is connected to (in this case, pin 17)