Go Down

Topic: LED program need help!!!! (Read 359 times) previous topic - next topic

TheSpook

Mar 01, 2013, 02:19 am Last Edit: Mar 01, 2013, 02:23 am by TheSpook Reason: 1
Right for a project i am trying to control 5 LED's using VB. I have the VB code done and it creates a 5bit binary number that i am able to pass to arduino.

What i want to know is how do i split this string up into the separate bits so that i can process each one (which i know how to do)

Erdin

Walking through bits can be done with bitRead(), http://arduino.cc/en/Reference/BitRead
But you have to convert the serial data to a integer (or a byte).

TheSpook

Thanks for fast reply ill give that a go :D

TheSpook

right iv got it reading the separate bits but how do i reference the bitRead?

p.s. very new to arduino

Arrch


right iv got it reading the separate bits but how do i reference the bitRead?

p.s. very new to arduino


Depends on what you mean by "reference the bitRead".

You call the bitRead with something like this:

Code: [Select]
byte someBit = bitRead(someNumber, someBitPositionInTheNumber);


Go Up