Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Flow Light based on STONE HMI and Arduino

Status
Not open for further replies.

Justinli

Member level 4
Joined
Apr 29, 2021
Messages
76
Helped
0
Reputation
0
Reaction score
2
Trophy points
8
Activity points
413
I'm trying to make the flowing lights light up, but I'm not sure if there's something wrong with the code. I've written five different brightness modes, but the results seem similar.
Please don't blame me, I'm new to this.
I use Arduino UNO ( http://www.arduino.cc/ )
and STONE STVI050WT-03 ( http://www.stoneitech.com/product/by-application/industrial-type/stvi050wt-03.html )
Code:
int t = 40;
int rnd =5;
int pat1t =75;
void setup()
{
   for(int i=3; i<=12; i++)
   pinMode(i,OUTPUT);
}

void loop(){

   for(int i=0; i<=rnd; i++) {
   pat1();}
   for(int i=0; i<=rnd; i++){
   pat2();}
   for(int i=0; i<=rnd; i++) {
   pat3();}
   for(int i=0; i<=rnd; i++) {
   pat4();}
   for(int i=0; i<=rnd; i++){
   pat5();}
   for(int i=0; i<=rnd; i++) {
   pat6();}
   for(int i=0; i<=rnd; i++) {
   pat7();}
   for(int i=0; i<=rnd; i++) {
   pat8();}
   for(int i=0; i<=rnd; i++) {
   pat9();}
 
 
}
 
void pat1(){
    for(int i=3; i<=12; i++) {
      digitalWrite(i,HIGH);
      delay(pat1t);
      digitalWrite(i,LOW);

    }
   
    for(int i=11; i>=4; i--) {
      digitalWrite(i,HIGH);
      delay(pat1t);
      digitalWrite(i,LOW);
    }
} 
void pat2(){
     for(int i=3; i<=12; i++) {
      digitalWrite(i,HIGH);
      digitalWrite(i-1,HIGH);
      digitalWrite(i+1,HIGH);
      delay(100);
      digitalWrite(i,LOW);
      digitalWrite(i-1,LOW);
      digitalWrite(i+1,LOW);
    }
   
    for(int i=11; i>=4; i--) {
      digitalWrite(i,HIGH);
      digitalWrite(i-1,HIGH);
      digitalWrite(i+1,HIGH);
      delay(100);
      digitalWrite(i,LOW);
      digitalWrite(i-1,LOW);
      digitalWrite(i+1,LOW);
    }
}
void pat3(){
  for(int i=3; i<=12; i=i+2) {
      digitalWrite(i,HIGH);
      delay(100);
      digitalWrite(i,LOW);

    }
   
    for(int i=12; i>=3; i=i-2) {
      digitalWrite(i,HIGH);
      delay(100);
      digitalWrite(i,LOW);
    }     
}
void pat4(){ 
      for(int i=3; i<=12; i++) {
      digitalWrite(i,HIGH);
      delay(100);
    }
   
    for(int i=12; i>=2; i--) {
      digitalWrite(i,HIGH);
      delay(100);
      digitalWrite(i,LOW);
    }
}
void pat5(){
     for(int i=3; i<=12; i++) {
      digitalWrite(i,HIGH);
      }
    delay(100);
    for(int i=3; i<=12; i++) {
      digitalWrite(i,LOW);
      }
    delay(100); 
}
void pat6(){
       for(int i=3; i<=8; i++) {
      digitalWrite(i,HIGH);
      }
    for(int i=8; i<=12; i++) {
      digitalWrite(i,LOW);
      }
    delay(200);
    for(int i=3; i<=8; i++) {
      digitalWrite(i,LOW);
      }
    for(int i=8; i<=12; i++) {
      digitalWrite(i,HIGH);
      }
    delay(200);
}
void pat7(){
       for(int i=3; i<=12; i=i+2) {
      digitalWrite(i,HIGH);
      }
    for(int i=4; i<=12; i=i+2) {
      digitalWrite(i,LOW);
      }
    delay(200);
     for(int i=3; i<=12; i=i+2) {
      digitalWrite(i,LOW);
      }
    for(int i=4; i<=12; i=i+2) {
      digitalWrite(i,HIGH);
      }
    delay(200);
}
void pat8(){
    digitalWrite(7,HIGH);
    digitalWrite(8,HIGH);
    delay(t);
    digitalWrite(7,LOW);
    digitalWrite(8,LOW);
    delay(t);
    digitalWrite(6,HIGH);
    digitalWrite(9,HIGH);
    delay(t);
    digitalWrite(6,LOW);
    digitalWrite(9,LOW);
    delay(t);
    digitalWrite(5,HIGH);
    digitalWrite(10,HIGH);
    delay(t);
    digitalWrite(5,LOW);
    digitalWrite(10,LOW);
    delay(t);
    digitalWrite(4,HIGH);
    digitalWrite(11,HIGH);
    delay(t);
    digitalWrite(4,LOW);
    digitalWrite(11,LOW);
    delay(t);
    digitalWrite(3,HIGH);
    digitalWrite(12,HIGH);
    delay(t);
    digitalWrite(3,LOW);
    digitalWrite(12,LOW);
    delay(t);
     digitalWrite(4,HIGH);
    digitalWrite(11,HIGH);
    delay(t);
    digitalWrite(4,LOW);
    digitalWrite(11,LOW);
    delay(t);
    digitalWrite(5,HIGH);
    digitalWrite(10,HIGH);
    delay(t);
    digitalWrite(5,LOW);
    digitalWrite(10,LOW);
    delay(t);
    digitalWrite(6,HIGH);
    digitalWrite(9,HIGH);
    delay(t);
    digitalWrite(6,LOW);
    digitalWrite(9,LOW);
    delay(t);     
}   

void pat9(){
    for(int i=3; i<=12; i++) {
      digitalWrite(i,HIGH);
    }
     for(int i=3; i<=12; i++) {
      digitalWrite(i,LOW);
      delay(100);
      digitalWrite(i,HIGH);
    }
    for(int i=11; i>=4; i--) {
      digitalWrite(i,LOW);
      delay(100);
      digitalWrite(i,HIGH);
    }
 
}
 
Last edited by a moderator:

Are you trying to control a group of LEDs or the display shown in the link?

Your program may work with LEDs; you will need 9 LEDs connected to 9 pins.

To control the display, you need to have other libraries. I have no idea about this specific item but it should not be difficult once you get a hold of the manual.

How the display is interfaced with arduino?
 

Are you trying to control a group of LEDs or the display shown in the link?

Your program may work with LEDs; you will need 9 LEDs connected to 9 pins.

To control the display, you need to have other libraries. I have no idea about this specific item but it should not be difficult once you get a hold of the manual.

How the display is interfaced with arduino?
I have an 8pin cable connecting the display to the arduino, in fact I only need to use 4 of the pins, which are connected to the 3.3v, GND, TX and RX of the arduino.
My lights can light up, but they all look so similar in each mode, maybe I'm not doing a good enough job with the delay?
 

Hi,

I've read through this discussion many times now, but still
* don't know what the problem is
--> please provide a clear error description
* how and at wich pins the LEDs and the display is connected
--> please show a schematic. Hand drawn is O.K.
* what your code should do
--> pleae add "comments" to your code

Klaus
 

I do not understand how it works- if it is really working!

If you want to debug your software, just increase the delay argument (one at a time) and see which one is getting affected.

Yes, the connections are correct (as you describe). But the software need to transfer bytes (or nibbles) via the TX and RX lines and follow the protocol.

Setup a byte, transfer it along the TX, wait for ack and repeat. Look up how to use the serial ports in arduino.

But you still need to include the library for the STONE device; the library should have come with the instructions for the device.

Else google arduino library STVI050WT and select the most recent and compatible one.

Impossible to help with the information provided.
 

Here is the connection diagram of my LCD with Arduino and lights.

IMG_3327.JPG
IMG_3328.JPG
IMG_3329.JPG
IMG_3330.JPG
--- Updated ---

I may know what the problem is, I read the instruction manual of this touch screen carefully and found that the communication is done by reading and writing variable addresses of the control, I should set a buffer in my code to remember these variable addresses.
 
Last edited by a moderator:

Hi,

Here is the connection diagram of my LCD with Arduino and lights.
No. This is no connection diagram. This are 10 Mbytes of useless photos.
You take no effort to give clear informations, so don't be surprised if nobody can help.
We like to help, but it is not possible.

Klaus
 

Hi,


No. This is no connection diagram. This are 10 Mbytes of useless photos.
You take no effort to give clear informations, so don't be surprised if nobody can help.
We like to help, but it is not possible.

Klaus
I may understand what you need the connection diagram to mean, thank you very much for the enthusiastic replies.
I may know what the problem is, I read the instruction manual of this touch screen carefully and found that the communication is done by reading and writing variable addresses of the control, I should set a buffer in my code to remember these variable addresses.
When I finish modifying my code I will share the correct one here.
 

I may understand what you need the connection diagram to mean, thank you very much for the enthusiastic replies.
Although the process is simple at the top level, you MUST follow individual steps correctly and systematically.

If your hardware is not set up correctly, nothing can ever work because the underlying structure is defective.

And I am not sure your hardware is setup correctly. The serial connection is not done correctly (it is not clear) and you must understand the architecture of the information flow and display.
 

Although the process is simple at the top level, you MUST follow individual steps correctly and systematically.

If your hardware is not set up correctly, nothing can ever work because the underlying structure is defective.

And I am not sure your hardware is setup correctly. The serial connection is not done correctly (it is not clear) and you must understand the architecture of the information flow and display.
Yes, you're right, I burned an Arduino board at the beginning because I didn't understand how to connect the Arduino to the screen, but I get it now.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top