We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello, I'm new in processing. before I explain the problem, apologize for my bad english.
so I have a project using Raspbery Pi and connected to the robot (arduino) via bluetooth. serial port used is / dev / rfcomm0. I want RPI response "Turn On The Robot" when the robot does not live . I tried using Serial.list (), store it in a String and then compare it, it did not succeed. I'm new in programming java.
i really need help to solve this.
import processing.serial.*; char[] data_ = new char[10]; String serial_port; String save_port; String serialRfcomm = "/dev/rfcommO"; int WIDTH = 800; //x int HEIGHT = 470; //y int tunjuk = 0; PFont font; Serial BT; char x; boolean btCheck = false; void setup() { size(400, 240); smooth(); font = loadFont("~/App/data/AgencyFB-Reg-48.vlw"); textFont(font, 14); serial_port = BT.list()[0]; BT = new Serial(this, serial_port, 9600); } void draw() { background(0); serial_port = BT.list()[0]; // store serial port if ( serial_port == serialRfcomm) { // compare to take action if (!btCheck) { BT = new Serial(this, serial_port, 9600); btCheck = true; } textSize(14); text("robot Is ON", 10, 10); println("robot Is ON"); } else { // if not print it println(serial_port); println("Turn ON robot"); text("Turn ON Robot", 10, 10); } }