Virtual Wire incompatibility with Arduino [on hold]

I am using a 433MHz Tx and Rx pair to build a wireless remote control bag. I have researched and found that the Tx and Rx Virtual Wire codes are incompatible with the Arduino 1.6.9 software I am using. I have troubleshot some of the replacement errors through research, but continue to get other errors relating to compatibility as there is reference to Virtual Wire in many places in the coding. As I am not a coder, I need help with sorting this once and for all.

My original Virtual Wire coding is as below. Would be perfect if someone could please work through the coding and change it so it is compatible with Arduino 1.6.9

Thanks!

Remote Tx code

// TRANSMITTER CODE  //NOTE :- THIS TRANSMITTER CODE IS USED WHEN YOU WANT TO CONTROL THE ROBOT VIA THE BREADBOARD REMOTE #include <VirtualWire.h>  //Assigning controller buttons to Digital Pins int forward = 8; int backward = 9; int rightTurn = 10; int leftTurn = 11; int stopMotor = 12; int remotePins[]= {8,9,10,11,12};//array to store pin nos  void setup() {     Serial.begin(9600);   // Debugging only     Serial.println("setup");     // Initialise the IO and ISR     vw_setup(2000);  // Bits per sec     vw_set_tx_pin(3); //Transmitter Data Pin to Digital Pin 3       for(int i = 0; i<6 ; i++)     {       pinMode(remotePins[i], INPUT);       digitalWrite(remotePins[i],HIGH);     }       /*       This is what the loop above does :-         pinMode(8, INPUT);         pinMode(9, INPUT);         pinMode(10, INPUT);         pinMode(11, INPUT);         pinMode(12, INPUT);          digitalWrite(8, HIGH);         digitalWrite(9, HIGH);         digitalWrite(10, HIGH);         digitalWrite(11, HIGH);         digitalWrite(12, HIGH);*/ }//close setup  void loop() {   char *msg2;    if(digitalRead(forward) == LOW)//if the forward button is pressed   {     char *msg2 = "1";//send 1 to the receiver     digitalWrite(13, true); // Flash a light to show transmitting     vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver     vw_wait_tx(); // Wait until the whole message is gone     digitalWrite(13, false);   }    if(digitalRead(backward) == LOW)//if the back button is pressed   {     char *msg2 = "2";///send 2 to the receiver     digitalWrite(13, true); // Flash a light to show transmitting     vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver     vw_wait_tx(); // Wait until the whole message is gone     digitalWrite(13, false);   }    if(digitalRead(leftTurn) == LOW)//if the left button is pressed   {     char *msg2 = "3";//send 3 to the receiver     digitalWrite(13, true); // Flash a light to show transmitting     vw_send((uint8_t *)msg2, strlen(msg2));//send the byte to the receiver     vw_wait_tx(); // Wait until the whole message is gone     digitalWrite(13, false);   }    if(digitalRead(rightTurn) == LOW)//if the right button is pressed   {     char *msg2 = "4";//send 4 to the receiver     digitalWrite(13, true); // Flash a light to show transmitting     vw_send((uint8_t *)msg2, strlen(msg2));//send the message to the receiver     vw_wait_tx(); // Wait until the whole message is gone     digitalWrite(13, false);   }    if(digitalRead(stopMotor)==LOW)//if the stop button is pressed   {    char *msg2 = "5";//send 5 to the receiver    digitalWrite(13, true); // Flash a light to show transmitting    vw_send((uint8_t *)msg2, strlen(msg2));//send the message to the receiver    vw_wait_tx(); // Wait until the whole message is gone     digitalWrite(13, false);   }  }//close loop   // End Of Code  

Remote Rx Code

// RECIEVER CODE

//NOTE :- THIS CODE IS USED WHEN CONTROLLING THE ROBOT VIA THE BREADBORD REMOTE  #include <VirtualWire.h>  //declaring pin nos to FIRST L293D int en1 = 5;  int en2 = 6;  int in1 = 7;  int in2 = 8;  int in3 = 9;  int in4 = 10;  //declaring pin nos to SECOND L293D  int en1o2 = 3;  int en2o2 = 11;  int in1o2 = 4;  int in2o2 = 12;  int in3o2 = 14;  int in4o2 = 15;  int motorPin[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15};//array for storing pin nos  void setup() {     Serial.begin(9600); // Debugging only     Serial.println("setup");      // Initialise the IO and ISR     vw_setup(2000);  // Bits per sec     vw_set_rx_pin(2);    //Rx Data pin to Digital  Pin 2     vw_rx_start();       // Start the receiver PLL running      for (int i = 0; i < 12; i++)     {           pinMode(motorPin[i], OUTPUT);    } /* This is basically what the above for loop does :- pinMode(en1, OUTPUT); pinMode(en2, OUTPUT); pinMode(in1, OUTPUT); pinMode(in2, OUTPUT); pinMode(in3, OUTPUT); pinMode(in4, OUTPUT); pinMode(en1o2, OUTPUT); pinMode(en2o2, OUTPUT); pinMode(in1o2, OUTPUT); pinMode(in2o2, OUTPUT); pinMode(in3o2, OUTPUT); pinMode(in4o2, OUTPUT); */ }//close setup  void loop() {     uint8_t buf[VW_MAX_MESSAGE_LEN];     uint8_t buflen = VW_MAX_MESSAGE_LEN;      if (vw_get_message(buf, &buflen)) // Non-blocking     {     int i;          digitalWrite(13, true); // Flash a light to show received good message     // Message with a good checksum received, dump it.     for (i = 0; i < buflen; i++)     {      Serial.print(buf[i]);//print received command         if(buf[i] == '1')//if button 1 is pressed.... i.e.forward buton       {         forward();//go forward         Serial.println(" = forward");       }     if(buf[i] == '2')//if button 2 is pressed.... i.e.back buton       {         backward();//go backward         Serial.println(" = backward");       }         if(buf[i] == '3')//if button 3 is pressed.... i.e.left buton       {         left();//go left         Serial.println(" = left");       }         if(buf[i] == '4')//if button 4 is pressed.... i.e.right buton       {         right();//go right         Serial.println(" = right");       }         if(buf[i] == '5')//if button 5 is pressed.... i.e.stop buton        {          stopMotor();//stop/brake          Serial.println(" = stopped");        }         Serial.print(" ");     }     Serial.println("");         digitalWrite(13, false);     }//close if }//close loop   //////////////////////////////////////////////////////////////////////////////////////// //set of functions  void forward() {   digitalWrite(en1,HIGH);   digitalWrite(en2,HIGH);   digitalWrite(en1o2,HIGH);   digitalWrite(en2o2,HIGH);   digitalWrite(in1,HIGH);   digitalWrite(in1o2,HIGH);   digitalWrite(in2,LOW);   digitalWrite(in2o2,LOW);   digitalWrite(in3,LOW);   digitalWrite(in3o2,LOW);   digitalWrite(in4,HIGH);   digitalWrite(in4o2,HIGH);   }   void backward() {   digitalWrite(en1,HIGH);   digitalWrite(en2,HIGH);   digitalWrite(en1o2,HIGH);   digitalWrite(en2o2,HIGH);   digitalWrite(in1,LOW);   digitalWrite(in1o2,LOW);   digitalWrite(in2,HIGH);   digitalWrite(in2o2,HIGH);   digitalWrite(in3,HIGH);   digitalWrite(in3o2,HIGH);   digitalWrite(in4,LOW);   digitalWrite(in4o2,LOW);  }  void left() {   digitalWrite(en1,HIGH);   digitalWrite(en2,HIGH);   digitalWrite(en1o2,HIGH);   digitalWrite(en2o2,HIGH);   digitalWrite(in1,LOW);   digitalWrite(in1o2,LOW);   digitalWrite(in2,LOW);   digitalWrite(in2o2,LOW);   digitalWrite(in3,LOW);   digitalWrite(in3o2,LOW);   digitalWrite(in4,HIGH);   digitalWrite(in4o2,HIGH);  }  void right() {   digitalWrite(en1,HIGH);   digitalWrite(en2,HIGH);   digitalWrite(en1o2,HIGH);   digitalWrite(en2o2,HIGH);   digitalWrite(in1,HIGH);   digitalWrite(in1o2,HIGH);   digitalWrite(in2,LOW);   digitalWrite(in2o2,LOW);   digitalWrite(in3,LOW);   digitalWrite(in3o2,LOW);   digitalWrite(in4,LOW);   digitalWrite(in4o2,LOW);  }  void stopMotor() {   digitalWrite(en1,HIGH);   digitalWrite(en2,HIGH);   digitalWrite(en1o2,HIGH);   digitalWrite(en2o2,HIGH);   digitalWrite(in1,LOW);   digitalWrite(in1o2,LOW);   digitalWrite(in2,LOW);   digitalWrite(in2o2,LOW);   digitalWrite(in3,LOW);   digitalWrite(in3o2,LOW);   digitalWrite(in4,LOW);   digitalWrite(in4o2,LOW); }   //End Of Code 

Replay

Category: arduino Time: 2016-07-28 Views: 0
Tags: arduino

Related post

  • Six Wire Servo with Arduino 2015-08-06

    I have a Tamagawa 200 step servo, 6.4V. I want to test it with my Arduino Uno. My only problem is that it has 6 wires (white, red, black, green, blue and yellow) and I can not find a simple way to test it. My Question is: How/ What do I use to test i

  • Virtual Machine failover with KVM [on hold] 2016-06-26

    I'm trying failover of VM's in KVM Linux as a learning program. First I would like to know whether it is possible, if possible then what will be the possible approach for making it work hint or links for doing this. Scenario: 2 HV Bare metal (2 physi

  • Using Android with Arduino [on hold] 2016-07-27

    I want to create an android app that every X seconds (5 seconds for example) requests a URL (https://www.xxx.com/example.php) and sends the response of that URL via USB to arduino connected via USB using USB-OTG cable. Does anyone have any idea how t

  • Error in using Arduino virtual wire 2012-09-08

    I have this 433MHz RF Tx and Rx pair. I tried to transmit using following simple Arduino sketch, given in the VirtualWire manual. #include <VirtualWire.h> void setup() { vw_setup(2000); // Bits per sec } void loop() { const char *msg = "hello&q

  • Controlling a Brushless ESC with Arduino 2010-07-28

    I read this is possible here: http://chiphacker.com/questions/110/how-to-drive-drive-brushless-motor-with-arduino I'm just getting started with Arduino and electronics in general, can anyone recommend a tutorial or guide that could serve as a startin

  • 4x8 LED Scrolling Display with Arduino 2010-08-10

    So I am wanting to make a custom LED scrolling message display. Basically I have a surface I am going to mount 32 LED's to and then have them controlled by an Arduino. What kind of hardware would I need and what would you suggest for a power source,

  • What's the cheapest way to detect vibration with Arduino? 2011-03-29

    What's the cheapest way to detect vibration with Arduino? What's the vibration sensor that I need? I want to detect PING PONG NET vibration and light on led if touched. --------------Solutions------------- Piezo sensors are cheap, reliable and design

  • Is it Possible to Control Vehicle Key Fob/Remote Start with arduino board? 2011-12-13

    Curious if there are any projects out there in which someone controlled a remote vehicle starter with an arduino board. Specifially, I am considering a method to start my car at a preset time every morning. I am thinking it would be easy to wire up a

  • Controlling an electromagnet with Arduino 2012-04-29

    I'm just starting up with electronics and looking to control an electromagnet with the Arduino. I'm wondering what hardware setup will make the most sense to use to turn the electromagnet on and off at around 10 times per second. I plan to make the m

  • Hacking a treadmill with Arduino? 2013-08-19

    I'd like to write a desktop app that would be able to automatically read all measurements off my treadmill, and to fully control the treadmill instead of the native dashboard. Unfortunately I know next to nothing about electrical engineering, and I w

  • Ethernet controller ENC28J60 not working with Arduino Nano nor Mega 2013-11-01

    I have a problem with running ENC28J60 with Arduino with EtherCard.h. This is the device I use: http://img20.allegroimg.pl/photos/oryginal/36/70/08/91/3670089168 This is the library and examples: https://github.com/jcw/ethercard I use Arduino IDE 1.5

  • Problem with Arduino UNO and RC servo 2013-12-15

    This is my first attempt to work with a servo and I'm using this tutorial. I have a "TowardPro MG996R DIGI HI TORQUE" servo directly connected to my Arduino Uno as follows: I also created the following code to upload onto the Arduino: #include&l

  • Accurately measuring temperature with Arduino 2013-12-23

    I'm trying to build thermostat with Arduino. I want to power it using mobile phone battery/charger which makes system voltage quite variable. Right now I use Arduino Uno, but once it is complete I will port it to Lilypad. First I tried to use TMP36 t

  • Getting ADXL345 accelerometer to work over SPI with Arduino Uno 2013-12-25

    I'm using this cheap ADXL chip with Arduino Uno. When I read the sensor with I2C - it works fine. However I have some servo motors as well which generate a lot of noise and when I turn the motors on, the sensor readings become pretty much useless. I

  • The program or feature "\??\D:\data\setup.exe" cannot start or run due to the incompatibility with 64-bit version of windows" 2014-01-16

    I was trying to install a very old game and when i click the setup button this message appears. The program or feature "\??\D:\data\setup.exe" cannot start or run due to the incompatibility with 64-bit version of windows" please me solve th

  • How do I control several individual LEDs with Arduino? 2014-09-07

    I am working in a book store and I have the task of making an indication of a book place in the Library Cupboard with LEDs. I need to control about 300 LEDs with Arduino. What is the optimum way to do this task? I think I can't use shift registers be

  • Interfacing barcode scanner with arduino using RS232 2015-02-06

    I want to connect a barcode scanner with Arduino. I used MAX232 to convert the levels. I have taken only 3 pins: 2(RX), 3(TX) and 5(GND) from the DB9 cable and given them to pins of MAX232 as shown in the figure: This is the code written in Arduino:

  • LM358 circuit with Arduino micrcontroller ADC input 2015-09-19

    Need help use LM358 circuit with Arduino micrcontroller ADC input I want to implement a LED fault compensation circuit. When a LED has failed, there will be an open circuit and no current will flow through the string. Hence, a zero current will be se

  • Short circuit when probing live ATX power supply primary section with voltmeter [on hold] 2016-02-02

    I was probing around an old ATX PSU to inspect voltage levels in the primary section. The first 15 minutes went smooth (bridge rectifier inputs, big caps, Power IC Vcc, etc..) but as soon as I probed the solder pads of the large coil circled in red i

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 1.115 (s). 13 q(s)