RoboRemo Tutorial 8 # Custom Button Images

2017-06-10

In RoboRemo you can change the button images. For each button you can choose a pressed image and a released image. You browse for the image files on the SD card of the phone and choose the desired icon. I recommend using PNG files with transparent background. A resolution of 256x256 pixels if more than enough, since the button will not fill the entire screen. You can design your own images, or you can buy the ones that I created:
https://www.etsy.com/listing/522205028/button-png-images-6-colors-round
It is a zip archive containing pressed and released button images for 6 colors, totally 12 PNG files. Just unzip them and copy to the SD card of your phone, then use them in RoboRemo. Here is a video:


The images will be stored in the RoboRemo interface, so you can export and use the interface on other device as well, without the need of the image files.

RoboRemo Tutorial 7 # Testing the interface locally by connecting via UDP to localhost

2017-06-05

This video tutorial is about locally testing a RoboRemo interface. You simply connect via UDP to localhost:9999 (or other port), so all the packets that the RoboRemo is sending will come back to it, and will be interpreted as received from the remote device (Arduino or whatever). I personally use this pretty much for testing the functionality of the app. to make sure everything works as expected. I think this is a faster way to test the interface that you build, so I thought to share this trick with you.

RoboRemo Tutorial 6 # Text log

2017-06-05

Text log is an interface item / widget that you can use to display some text. When it receives new text, the old text will automatically scroll up, like in a computer terminal. The text log is intended mainly for debugging purpose. For example if you are developing a gadget and you need to output some debug info at specific parts of your code, then simply send it via UART and have your device connected to RoboRemo. The debug info will appear in the text log. You can add a prefix to the string you are sending and also set the id of the text log to that prefix, so you can have different strings appear in different text logs. See the video below for a text log example.


And here is the Arduino code:

// RoboRemo Tutorial 6 # Text log
// www.roboremo.com

// Hardware setup:
// Arduino ---<OTG cable>--- Android tablet

// D2---220R---LED---GND

// D3-----BUTTON-----GND

int ledPin = 2;

int buttonPin = 3;
int buttonState;
int oldButtonState = 1;

char cmd[100];
int cmdIndex;

void exeCmd() {

  if(strcmp(cmd, "led 1")==0) {
    digitalWrite(ledPin, HIGH);
    Serial.println("debug Arduino LED turned ON");
  }
  
  if(strcmp(cmd, "led 0")==0) {
    digitalWrite(ledPin, LOW);
    Serial.println("debug Arduino LED turned OFF");
  }
}

void setup() {
  
  delay(500);
  
  Serial.begin(115200);
  
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  pinMode(buttonPin, INPUT_PULLUP);
  
  cmdIndex = 0;
}

void loop() {
  
  if(Serial.available()) {
    
    char c = (char)Serial.read();
    
    if(c=='\n') {
      cmd[cmdIndex] = 0;
      exeCmd();  // execute the command
      cmdIndex = 0; // reset the cmdIndex
    } else {      
      cmd[cmdIndex] = c;
      if(cmdIndex<99) cmdIndex++;
    }
  }

  oldButtonState = buttonState;
  buttonState = digitalRead(buttonPin);

  if(buttonState != oldButtonState) { // button state changed
    if(buttonState == 0) { // button pressed = pin connected to GND
      Serial.print("led 1\n"); // turn ON the virtual LED
    } else {
      Serial.print("led 0\n"); // turn OFF the virtual LED
    }
  }
}

RoboRemo Tutorial 5 # Connect and Disconnect using Buttons

2017-06-05

Using menu -> connect and then selecting the device may become annoying sometimes. That's why you may want to make 2 special buttons for connecting and disconnecting with a single click. In the video below I explain how you can do that.


The Arduino code is the same as in the previous tutorial, It does not require any modification.

RoboRemo Tutorial 4 # Interface Export, Import

2017-06-05

Here is how to export the RoboRemo interface to a file and import it on another Android device, so that you don't need to create it again from zero.


If you are looking for the Arduino code, see the previous tutorial.

RoboRemo Tutorial 3 # Connect via Bluetooth

2017-06-05

In this video I show how to use a Bluetooth module like BlueSMiRF to replace the OTG cable. So now the Arduino and the Android tablet will communicate via Bluetooth SPP.


See previous tutorial for the source code, as it is the same.

RoboRemo Tutorial 2 # Virtual LED

2017-06-05

In this tutorial I explain how to read a pushbutton that is connected to Arduino, and use it to turn ON and OFF a virtual LED on the RoboRemo interface.


And here is the source code:

// RoboRemo Tutorial 2 # Virtual LED
// www.roboremo.com

// Hardware setup:
// Arduino ---<OTG cable>--- Android tablet

// D2---220R---LED---GND

// D3-----BUTTON-----GND

int ledPin = 2;

int buttonPin = 3;
int buttonState;
int oldButtonState = 1;

char cmd[100];
int cmdIndex;

void exeCmd() {

  if(strcmp(cmd, "led 1")==0) {
    digitalWrite(ledPin, HIGH);
  }
  
  if(strcmp(cmd, "led 0")==0) {
    digitalWrite(ledPin, LOW);
  }
}

void setup() {
  
  delay(500);
  
  Serial.begin(115200);
  
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  pinMode(buttonPin, INPUT_PULLUP);
  
  cmdIndex = 0;
}

void loop() {
  
  if(Serial.available()) {
    
    char c = (char)Serial.read();
    
    if(c=='\n') {
      cmd[cmdIndex] = 0;
      exeCmd();  // execute the command
      cmdIndex = 0; // reset the cmdIndex
    } else {      
      cmd[cmdIndex] = c;
      if(cmdIndex<99) cmdIndex++;
    }
  }

  oldButtonState = buttonState;
  buttonState = digitalRead(buttonPin);

  if(buttonState != oldButtonState) { // button state changed
    if(buttonState == 0) { // button pressed = pin connected to GND
      Serial.print("led 1\n"); // turn ON the virtual LED
    } else {
      Serial.print("led 0\n"); // turn OFF the virtual LED
    }
  }
}

RoboRemo Tutorial 1 # Button

2017-06-05

This is the first tutorial, showing how to use a button in RoboRemo to turn ON and OFF an LED on the Arduino. The Arduino Nano is connected to the Android tablet via OTG cable.


The source code is visible in the video and I strongly recommend to manually write it if you really want to learn programming, but if you still want it in text format, here it is:

// RoboRemo Tutorial 1 # Button
// www.roboremo.com

// Hardware setup:
// Arduino ---<OTG cable>--- Android tablet

// D2---220R---LED---GND

int ledPin = 2;

char cmd[100];
int cmdIndex;

void exeCmd() {

  if(strcmp(cmd, "led 1")==0) {
    digitalWrite(ledPin, HIGH);
  }
  
  if(strcmp(cmd, "led 0")==0) {
    digitalWrite(ledPin, LOW);
  }
}


void setup() {
  
  delay(500);
  
  Serial.begin(115200);
  
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  
  cmdIndex = 0;
}


void loop() {
  
  if(Serial.available()) {
    
    char c = (char)Serial.read();
    
    if(c=='\n') {
      cmd[cmdIndex] = 0;
      exeCmd();  // execute the command
      cmdIndex = 0; // reset the cmdIndex
    } else {      
      cmd[cmdIndex] = c;
      if(cmdIndex<99) cmdIndex++;
    }
  }
}