• Control LED RGB WS2812B using Bluetooth and Android

QC

Control LED RGB WS2812B using Bluetooth and Android

 


Project description

Short tutorial how to control LED RGB WS2812B with Android Application through Bluetooth communication. This project is another development of my other projects about bluetooth remote control. The beautiful color resulted from the LED RGB WS2812B or commonly called as Neo Pixel or Addressable Led, this color could create such an amazing lighting effect for home decoration, DIY projects or for commercial purposes. This Led would be much interested if we could control the light by our phone. So, by that I try to create an Android App by online MIT App Inventor, and create a simple Arduino sketch to be syncronized with the Android App.




#include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif #define LED_PIN 2 #define LED_COUNT 13 Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); int k; int val; void setup() { Serial.begin(9600); #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif strip.begin(); strip.show(); strip.setBrightness(50); } void loop() { if (Serial.available()) { val = Serial.read(); if (val == 'R') //Rainbow { rainbow(10); } if (val == 'r') // red { colorWipe(strip.Color(255, 0, 0), 50); } if (val == 'g') // green { colorWipe(strip.Color(0, 255, 0), 50); } if (val == 'b') // blue { colorWipe(strip.Color(0, 0, 255), 50); } if (val == 'w') // white { colorWipe(strip.Color(255, 255, 255), 50); } if (val == 'y') //yellow { colorWipe(strip.Color(255, 255, 0), 50); } if (val == 'm') //magenta { colorWipe(strip.Color(255, 0, 255), 50); } if (val == 'c') //cyan { colorWipe(strip.Color(0, 255, 255), 50); } if (val == 'o') //off { colorWipe(strip.Color(0, 0, 0), 50); } } } void rainbow(int wait) { for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) { for(int i=0; i<strip.numPixels(); i++) { int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels()); strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue))); } strip.show(); delay(wait); } } void colorWipe(uint32_t color, int wait) { for(int i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, color); strip.show(); delay(wait); } }











Error No module Onnx opencv

 Error No module Onnx opencv Lệnh :  pip install onnx==1.9 Mã lỗi PS F:\opencv_e\2.video> & C:/Users/youtb/Anaconda3/envs/virtualenv/...