SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By buxtronix
#134314
For Arduino (you can adapt to your need if pure avr):
Code: Select all
void setup() {
  Serial.begin(9600);
  char *str = "0123";
  for (char *c = str ; *c ; c++)
    for (char b = 7 ; b > -1 ; b--)
      Serial.print((*c >> b) & 0x1 ? "1" : "0");
}

void loop() {
}
By stevech
#134353
caltex88 wrote:Hi i had a ASCII string, how do i convert it into binary?

I was told to use bit masking to do it.

thanks in advance
Is the GPS NMEA data question again?