Announcement

Collapse
No announcement yet.

Arduino Proyect

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sherwin4D
    replied
    Hi Marc,

    It's our pleasure to help and I'm glad you already have it implemented to your project.

    If you have other inquiries, don't hesitate to ask.

    Best regards,
    Sherwin

    Leave a comment:


  • Exbo7
    replied
    Hi,

    The program works. I implement this for the real proyect and also run.

    Thank you for your time and for your help.

    Marc

    Leave a comment:


  • sherwin4D
    replied
    Hi Marc,

    From what I can understand, what you want to accomplish are:

    *Turn an LED on/off if push button is pressed
    *Turn USER LED on/off in the display if push button is pressed

    In other words, if push button is pressed, both LED and USER LED will turn on/off.

    Since you said the LEDs are now turning on and off(blinking), I assume that you already have the connections
    done properly. Below is your code that I modified:

    Code:
    #include <genieArduino.h>
    #include <SoftwareSerial.h>
    
    SoftwareSerial Display(2, 3);
    
    Genie genie;
    
    int valorPulsador;              //Value of Button
    int pulsadorPin = 5;            //Pinout of the button
    
    int LEDpin = 6;                 //LED pin
    boolean ledState = false;       //LED state
    
    void setup()
    {
      Serial.begin(9600);
      Display.begin(9600);
      genie.Begin(Display);
      // a few options to talk to the Display, uncomment the preferred serial port and baud rate
    
      //Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
      //See the app note 4D-AN-P4017-ViSi-Genie Connecting a 4D Display to an Arduino Host
      //for information if using jumper connecting wires
      pinMode(4, OUTPUT);   // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
      digitalWrite(4, 0);   // Reset the Display via D4
      delay(100);
      digitalWrite(4, 1);   // unReset the Display via D4
     
      delay (3500);         //let the display start up
    
      pinMode(pulsadorPin, INPUT_PULLUP);   //we use INPUT_PULLUP because I think you are using momentary switch
      pinMode(LEDpin, OUTPUT);   //LED output connected at pin 3
    
    }
    
    void loop()
    {
      valorPulsador = digitalRead(pulsadorPin);
    
      if (valorPulsador == 0) {
        boolean ledState = !ledState;
        delay(100);
        genie.WriteObject(GENIE_OBJ_USER_LED, 0x00, ledState);
        digitalWrite(LEDpin, ledState);
      }
    }
    If you noticed, I have already added an LED pin and changed the pin of push button at the modified code, so all you have to do is connect the LED and push button to corresponding digital pin to check if the code is working.

    Please take time to compare the original code with the modified code. And, if this doesn't work, feel free to post picture of your setup so I could assist you further with your project.

    Hope this helps and best regards,
    Sherwin
    Last edited by sherwin4D; 27th March 2019, 01:18 PM.

    Leave a comment:


  • Exbo7
    started a topic Arduino Proyect

    Arduino Proyect

    Hello,

    I have a question about a project I'm doing with Arduino. I've been looking at your appnotes and manuals to learn how to do it but I can't find the solution. A simple way to explain the project I'm doing and the way I first tried to simulate is as follows:
    I have a physical button which is connected to the digital pin 2 of the arduino one of its legs and the other at 5V. What I want to do is that when I press the button I light a led and a user led on the screen. I've tried but this when it runs is all the time on and off the LEDs, regardless of the status of the button. When using a button that provides 1 or 0, I have to use PININPUTS to create an event that controls the leds? Or directly with the status of the button could be done?
    I enclose the code that I have made in case you see any failure.

    Code:
    #include <genieArduino.h>
    
    Genie genie;
    
    
      int valorPulsador = 0;           //Value of Button
      int pulsadorPin = 2;             //Pinout of the button
     
    void setup()
    {
      Serial.begin(9600);
      // a few options to talk to the Display, uncomment the preferred serial port and baud rate
      // make sure that the ViSi Genie program has the same baud rate
      genie.Begin(Serial);  //Serial0   
      //Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
      //See the app note 4D-AN-P4017-ViSi-Genie Connecting a 4D Display to an Arduino Host
      //for information if using jumper connecting wires
      pinMode(pulsadorPin,INPUT);
      pinMode(4, OUTPUT);   // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
      digitalWrite(4, 0);   // Reset the Display via D4
      delay(100);
      digitalWrite(4, 1);   // unReset the Display via D4
     
      delay (3500);         //let the display start up
    }
    
    void loop()
    {
      valorPulsador = digitalRead(pulsadorPin);
      genie.WriteObject(GENIE_OBJ_LED, 0x00, 0);
      if (valorPulsador == HIGH){
        genie.WriteObject(GENIE_OBJ_LED, 0x00, 1);
        delay(50);
      }
    }
    Thank you for your time. I'm trying to slowly learn how to make the screen work with arduino.

    Marc
Working...
X