How to use light_ws2812 in C++

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone!

I have a question:

 

How do I use the light_ws2812 library ( https://github.com/cpldcpu/light_ws2812) in C++ code with my ATMega2560 in Atmel Studio???

 

I have no ideafrown

 

Thanks for your help

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


RTFM?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, that I also read, but I mean, how do I use it in code??? I havo no Idea...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

presumably there is further documentation in the repository?

 

and people like Sparkfun & Adafruit have loads of examples & tutorials ...

 

plenty of previous discussions here, too.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Mar 19, 2020 - 07:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are the examples in the examples folder not useful ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you search Freaks for light_ws2812? I've done this once before. As I showed there I added the light_ws2812 files to AS7 and got it to build.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately not, there are only examples for use in the arduino ide😥

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes that I also did: #include"WS2812.h" works fine, but I have no idea how to control the LEDs in code, also no examples or suggestions in the documentation of this library, only these written in C😥

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No examples? Exactly how hard did you look? I have half an idea the "examples" directory may just have the odd example...

 

https://github.com/cpldcpu/light...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WS2812 interfacing is high-level programming for the AVR.  It often involves in-line assembler. 

 

Can you describe your hardware platform and your level of programming expertise?  Have you done recursive quick-sorts in another CPU, or are you on the "get LED to blink " level?

 

Do you have electronics tools available like a digital oscilloscope and PC-based USB logic analyzer?  Do you have experience using them?

 

  A large percentage of new projects using the Mega2560 use the Arduino Mega platform, because you can get an order-of-magnitude gain in your software output productivity by using pre-written and pre-tested Arduino Mega libraries and examples.   Is there are reason why you can't/won't use the Arduino system for a new ATmega2560 project? Why are you using the ATmega2560 specifically?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
WS2812 interfacing is high-level (sic?) programming for the AVR.

Don't you mean low level ?

 

  It often involves in-line assembler. 

Doesn't get much lower than that!

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use "high-level" in this case as a synonym for advanced as in requiring a high level of technical knowledge as opposed to "high level" being a technical classification of the level of data abstraction characteristic to an individual computer language.

 

The civilized world is ending: give me a break.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Doesn't get much lower than that!

Huh? ASM was high level about 40 years ago when I used to enter op-codes via a monitor program. cheeky

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Opcodes? Luxury. My first CPU had a latching hex key pad. You had to write the code, hand assemble, then type in the hex pairs (which you could not edit, so had to restart data entry after any mistake) 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Opcodes? Luxury. My first CPU had a latching hex key pad. 

Likewise.

 

IIRC, it was a Heathkit ...

 

(and not actually mine).

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
The civilized world is ending

and you're here worrying about pretty flashing lights ?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Sun. Mar 22, 2020 - 11:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The civilized world is ending

Us uncivilized grubs will live on forever.  devil

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
latching hex key pad

Hex pad! What a luxury!

I entered opcodes using the the toggle switches on an Imsai 8080...

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and you try to tell that to kids o' today ...

 

frown

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...