
I have stucked in a code of DMD master Library trying to control some Scrolling Message on my P10 96x32 Led Display. What i have already done is by pressing a button in my visual basic app sending some strings to the arduino and the scrolling message scrolls on my display. What i m trying to figure out is how to break this while loop on the code. Let me explain. Lets say i will press the button 5 times. What is gonna happen is seeing my message scrolls the display 5 times (Thats ok). Looks like arduino stores these orders somewhere.
What i want to do is break this 5 times loop by sending another order from my visual basic app. For example when another button pressed the loop should stop. Is there any way to make that happen ?

Arduino code :
Code: Select all
case 'S' : //SCROLING TEXT
Timer1.initialize(1000 ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD );
dmd.clearScreen( true );
dmd.selectFont(Arial_Black_16_ISO_8859_1);
memset(stringb, 0, sizeof(stringb)); // set string contents to zero
Serial.setTimeout(50); // second input timeout
i = Serial.readBytesUntil('\n', stringb, sizeof(stringb)-1);
dmd.drawMarquee(stringb,strlen(stringb),(32*DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret) {
if ((timer+30) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}
}
Visual Basic Code :
Code: Select all
Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
SerialPort1.WriteLine("S" & RichTextBox1.Text)
End Sub