0

LEDs not working with M0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: LEDs not working with M0

by franklin97355 on Sat Jun 15, 2019 6:20 pm

Did you install the ARDUINO SAMD boards too?

franklin97355
 
Posts: 21071
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 6:53 pm

Capture.PNG
Capture.PNG (50.68 KiB) Viewed 131 times


This is the installed Arduino SAMD package I have

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by franklin97355 on Sat Jun 15, 2019 7:17 pm

Can you post the code here? Please use code tags when posting code or logs to the forums. It preserves formatting and makes it easier for everyone to read the code. Click the code button above the reply box and past your code between the tags created. Or you can post a link to the code if you are copying it from somewhere.

franklin97355
 
Posts: 21071
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: LEDs not working with M0

by batman189 on Sat Jun 15, 2019 11:03 pm

Code: Select all | TOGGLE FULL SIZE
/*Original sketch here:
https://hackaday.io/project/9017-skywalker-lightsaber/log/72354-adafruit-trinket-m0-controlling-the-onboard-dotstar-led-via-arduino-ide

get the adafruit dotstar library zip file here:
https://github.com/adafruit/Adafruit_DotStar

tested and works fine on Adafruit Trinket M0

*/


#include <Adafruit_DotStar.h>

#define NUMPIXELS 1 // Number of LEDs in strip

// Here's how to control the LEDs from any two pins:
#define DATAPIN   7
#define CLOCKPIN   8

Adafruit_DotStar strip = Adafruit_DotStar(
  NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BGR);



void setup() {
  strip.begin(); // Initialize pins for output
  strip.show();  // Turn all LEDs off ASAP
}

void loop() {
  strip.setPixelColor(0, 0xFF0000); // red
  strip.show();
  delay(1000);

  strip.setPixelColor(0, 0x00FF00); // green
  strip.show();
  delay(1000);

  strip.setPixelColor(0, 0x0000FF); // blue
  strip.show();
  delay(1000);
}


XRAD was kind enough to give me that code to test with, that is what I have been trying. I have also tried to use the code given in the Arduino section of this adafruit guide: https://learn.adafruit.com/breath-of-th ... d/overview

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by adafruit2 on Sat Jun 15, 2019 11:10 pm

yeah hold on something is amiss with our latest SPI code...

adafruit2
Site Admin
 
Posts: 18656
Joined: Fri Mar 11, 2005 7:36 pm

Re: LEDs not working with M0

by XRAD on Sun Jun 16, 2019 9:05 am

Thx Batman. Seems like Adafruit2 is on the scene. Look for an update soon in the 'manage libraries.....' or github ..

XRAD
 
Posts: 501
Joined: Sat Nov 19, 2016 3:28 pm

Re: LEDs not working with M0

by adafruit2 on Sun Jun 16, 2019 1:50 pm

update samd core to 1.5.1

adafruit2
Site Admin
 
Posts: 18656
Joined: Fri Mar 11, 2005 7:36 pm

Re: LEDs not working with M0

by batman189 on Sun Jun 16, 2019 5:51 pm

You guys are absoutely outstanding. The code was uploaded and it cycled through the colors on the Trinket just like XRAD said it should. After that was successful I copied the code from the adafruit project in my original post and it worked as well. I am going to put everything back together and give it a test and update you all. Thank you so much for your help!!!

batman189
 
Posts: 20
Joined: Sun Jun 02, 2019 9:37 pm

Re: LEDs not working with M0

by XRAD on Mon Jun 17, 2019 7:03 am

Congrats! You just broke into the awesome world of microprocessor programming!

XRAD
 
Posts: 501
Joined: Sat Nov 19, 2016 3:28 pm

Please be positive and constructive with your questions and comments.