Go Down

Topic: Blink the ColorLED project (Read 153 times) previous topic - next topic

ML-10

Feb 14, 2020, 11:07 am Last Edit: Feb 14, 2020, 11:09 am by ML-10
I got this Itty Bitty City set and tinkered with the examples, but I just wanted to be creative.

So I started small and tried to make a blinking light work, but there were too many errors and problems. I don't know if this is meant to be in a different section, but I chose this one cause it seemed best.

First, I started with just a Core module, then uploaded a blank sketch. It couldn't talk with the programmer.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync:


So I found some stuff on the forums and pressed 'Burn Bootloader' and...

avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

I am very new to IoT and physical programming, so I don't know what to do now.
Let me know if you need any info from the board or the IDE.

Also, the PWR(LED1) on the Core module is not turning on.

UKHeliBob

Quote
I got this Itty Bitty City set and tinkered with the examples
Please provide a link to what you have got.  It means nothing to me

Did the examples upload and work as expected ?
Which version of the IDE are you using and what Operating System on the PC ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

DVDdoug

#2
Feb 14, 2020, 07:25 pm Last Edit: Feb 14, 2020, 07:27 pm by DVDdoug
Quote
First, I started with just a Core module,
If you are new to this stuff, I'd recommend you get a "regular Arduino" such as an Uno or Nano, etc.

They come with the bootloader already installed
(so you don't need avrdude or a separate programmer).

The IDE & bootloader are one of the things that makes the Arduino great!    I've worked with several software development environments (and one other firmware development system*) over the years and I'm usually happy if I can get set-up and run a simple program in the first day.   

When I first got the Arduino it took about 15 minutes to download, install, plug-in the USB, download the Blink Example, and run!   That was amazing to me!


* I've also worked for companies where other engineers/porgrammers were doing firmware development for different microcontrollers and normally "it ain't easy".

ML-10

I am using version 1.8.4 of the Arduino for Microduino IDE and on Windows 10 version 1903
And here is my code:

Code: [Select]

#include <Microduino_ColorLED.h> //Import the library for the ColorLED.
#define COLOR_MAX 255   //Max value for ColorLED
#define COLOR_MIN 0     //Min value for ColorLED

uint32_t Color[11] = {
  COLOR_NONE,
  COLOR_WARM,
  COLOR_COLD,
  COLOR_RED,
  COLOR_ORANGE,
  COLOR_YELLOW,
  COLOR_GREEN,
  COLOR_CYAN,
  COLOR_BLUE,
  COLOR_PURPLE,
  COLOR_WHITE
};

ColorLED strip = ColorLED(1, 6);
uint32_t rainTimer;
uint32_t breathTimer;
uint32_t blinkTimer;
bool breathFlag = true;

void setAllColor(uint32_t c){
  for (uint8_t i = 0; i < strip.numPixels(); i++)//Select all LEDs.
  {
    strip.setPixelColor(i, c);//Set the color.
  }
  strip.show();  //Light up the LEDs to new colors.
}
void setAllLed(uint8_t color){
  setAllColor(Color[color]);
}
void setColor(uint32_t c, uint8_t i){
  strip.setPixelColor(i, c);//Set the color.
  strip.show();  //Light up the LED to new color.
}
void setLed(uint8_t color, uint8_t i){
  setColor(Color[color], i);
}
uint32_t Wheel(uint8_t  WheelPos) {
  if (WheelPos < 85) {
    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
    WheelPos -= 170;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
void ledRainbow(uint8_t wait) {
  if (millis() - rainTimer > wait)
  {
    uint8_t i = (millis() / wait) & 0xFF;
    setAllColor(Wheel(i));
    rainTimer = millis();
  }
}
void ledBreath(uint32_t color, uint8_t wait) {
  if (millis() - breathTimer > wait)
  {
    uint8_t i = (millis() / wait) & 0xFF;
    if (i < 2)
      breathFlag = !breathFlag;
    if (!breathFlag)
      i = 255 - i;

    strip.setBrightness(i);       //设置彩灯亮度
    setAllColor(color);
    breathTimer = millis();
  }
}
void ledBlink(uint8_t wait, uint32_t color, uint8_t j){
  if (millis() - blinkTimer > wait)
  {
    if ((millis() / wait) % 2)
      setColor(color, j);
    else
      setColor(0, j);
    blinkTimer = millis();
  }
}
void allLedBlinkNum(uint8_t num, uint32_t color, uint16_t wait){
  for (uint8_t i = 0; i < num; i++)
  {
    setAllColor(COLOR_NONE);
    delay(wait);
    setAllColor(color);
    delay(wait);
  }
  setAllLed(COLOR_NONE);
}
void ledBlinkNum(uint8_t num, uint32_t color, uint8_t index, uint16_t wait){
  for (uint8_t i = 0; i < num; i++)
  {
    setColor(COLOR_NONE, index);
    delay(wait);
    setColor(color, index);
    delay(wait);
  }
  setColor(COLOR_NONE, index);
  delay(wait);
}
void setup(){
  ledRainbow(1);
}
void loop(){
  
}

TomGeorge

Hi,
I got this Itty Bitty City set and tinkered with the examples, but I just wanted to be creative.
I am using version 1.8.4 of the Arduino for Microduino IDE and on Windows 10 version 1903


What are these, links please.
Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

ML-10

https://microduinoinc.com/itty-bitty-city/                                                         (IBC)

and

https://wiki.microduinoinc.com/Getting_started:_Windows#Download                (IDE)

Go Up