Usage Example for Arduino-Wireless Code Upload
Last revision 2026/01/22
1.When using WPMs to upload code for your remote Arduino processor,you need a pair of this module.
2.As the Arduino board does not have to connect with PC, so do not forget external power supply, such as some batteries.
Setting for the WPM
- Step 1:Please first set the two WPMs according to the Configuration steps mentioned above.
- Step 2:(Set Both WPMs first.)
- Close the software.
- Make sure to switch the "Mode" to "OFF" position.
- The "PROG_EN" switch should still at "ON" position.
- Step 3:Plug one WPM on the XBee Adapter and another on an IO Expansion Shield or Xbee shield for Arduino.
- Step 4:Stack the IO Expansion Shield on the Arduino board(Use UNO as an example.)
- Step 5:Connect the USB Adapter to your PC, and choose the right com port in the Arduino IDE.
- Step 6:Open Arduino program in the Arduino IDE and press "upload".Then the "LINK" light will blink if the communication is successful on the WPMs.
Test Code
Upload this code into the UNO board when the configuration and connection have been finished.
const int ledPin = 13; // the number of the LED pin
// Variables will change:
int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
long interval = 1000; // interval at which to blink (milliseconds)
void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}
Was this article helpful?
