Skip to main content
Question
Arduino
Bill SCHONFELDEROtto Master Builder
Senior Designer Level 3 (retired)
Asked a question 13 days ago

I want to take my blockly code and copy it into ardunio, I just want to see if it can be done. This is the code. Where do I put it inside of the ardunio code? What line would I paste this in? Thanks. #include <Adafruit_NeoPixel.h> Adafruit_NeoPixel pixel = Adafruit_NeoPixel(8, 7, NEO_GRB + NEO_KHZ800); void Single_gunfire_0() { pixel.setBrightness(160); pixel.setPixelColor(0, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_1() { pixel.setBrightness(160); pixel.setPixelColor(1, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_2() { pixel.setBrightness(160); pixel.setPixelColor(2, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_3() { pixel.setBrightness(160); pixel.setPixelColor(3, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_4() { pixel.setBrightness(160); pixel.setPixelColor(4, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_5() { pixel.setBrightness(160); pixel.setPixelColor(5, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_6() { pixel.setBrightness(160); pixel.setPixelColor(6, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Single_gunfire_7() { pixel.setBrightness(160); pixel.setPixelColor(7, 255, 0, 0); pixel.show(); delay(2*1000); pixel.clear(); pixel.show(); } void Multiple_fire() { pixel.setBrightness(170); pixel.setPixelColor(0, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(1, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setBrightness(40); pixel.setPixelColor(2, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(3, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(4, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(5, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(6, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(7, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setBrightness(40); pixel.setPixelColor(8, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); pixel.setPixelColor(9, 255, 102, 0); pixel.show(); delay(200); pixel.clear(); pixel.show(); } void setup() { pixel.begin(); pixel.clear(); pixel.show(); } void loop() { Single_gunfire_0(); pixel.clear(); pixel.show(); Single_gunfire_1(); pixel.clear(); pixel.show(); Single_gunfire_2(); pixel.clear(); pixel.show(); Single_gunfire_3(); pixel.clear(); pixel.show(); Single_gunfire_7(); pixel.clear(); pixel.show(); Single_gunfire_6(); pixel.clear(); pixel.show(); Single_gunfire_5(); pixel.clear(); pixel.show(); Single_gunfire_4(); for (int count=0 ; count<2 ; count++) { Multiple_fire(); } }

For more content join our community, sign up and become an Otto Builder now!

Related Questions

No related questions.

Question Stats

19 view
1 follower
Asked 2 times
Asked a question 13 days ago
Last asked 11 days ago
Views this month