I have char of string how to run it on arduino

Data such as

À
à
7
4
P
8
•
L

Those 8 x 8 bit can be increased to more like 50 x 50 bit
The data comes through a serial port. It enters the Arduino. How is it powered using a line-by-line shift register with 0.25 millisecond time slots between them?

I don't understand the question.

I want to send an 8 character string, "ABCDEFGH" or something, with each letter corresponding to the on position of an LED

me neither :grimacing:

I would suggest to study Serial Input Basics to handle this

give your sketch. i take a look.

I don't have a code

Do you have a spec of what the code should do?

ok. i take alook.

here is your solution

#define SRCLK 13 //clk
#define RCLK 6   //latch
#define SER 11

void setup() {
  Serial.begin(115200);
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);
}

void loop() {
  if (Serial.available() >= 8) {
    for (byte i = 0; i < 8; i++)shiftOut(SER, SRCLK, Serial.read());
    digitalWrite(RCLK, HIGH);
    digitalWrite(RCLK, LOW);
    while(Serial.available() > 0) Serial.read();
  }
}

Oops

Oops3

1 Like

is it mean I missed something?

You check to see if there's at least one character in the serial buffer, then you go ahead and read all eight of them.

he said 8 symbols should be read. so it is not my problem how he implement it, but after 8 symbols i read out remain charackters (CR&NL)

It's your implementation.

but you don't know if they are all available....

and you ignore the rest, so may be some of the symbols

yes, it may be CR symbol or NL, but important are only first 8, they can contain char(13) or char(10) and schould be count not as line terminator but as symbol to shift out.

but you are not guaranteed that 8 bytes were in the buffer with that code

testing with 8 instead of 0 would help

void loop() {
  if (Serial.available() >= 8) {
    for (byte i = 0; i < 8; i++)shiftOut(SER, SRCLK, Serial.read());
    digitalWrite(RCLK, HIGH);
    digitalWrite(RCLK, LOW);
    while(Serial.read() != -1)); // empty the buffer
  }
}
1 Like