Sending data to Arduino Uno using Java

I just bought an Arduino Uno, and now I'm trying to make a blinking LED. I was wondering how I can do this, and I looked at the Arduino Playground and found a program for entering information. I need to withdraw to Arduino. I can’t use anything other than Java, because I already have another program that requires Arduino. Please leave any ideas.

+4
source share
1 answer

EDIT: The kinds of sounds you want to make in java.

And an excerpt from the site mentioned by jayeff :

The output stream comes with three different recording methods for sending data from the computer to the Arduino. In the above example, you can use output.write(String) to send data, as in output.write("Hello Arduino!") .

If you are trying to use Java to write to Arduino, then this is your answer.

http://arduino.cc/playground/Interfacing/Java


EDIT . If you want to use something other than Java, here you are:

Ask and you will receive. You can do this in any programming language that has consistent support.

For each language, of course, there are other methods, but here are some of them that I found after 5 minutes in Google Machine

Note: Watch out for the nasty Auto Reset on a serial issue . See previous for more details.

Here is my C ++ code (it is ugly, but it works)

 #include <SerialStream.h> #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; class SerialComm { LibSerial::SerialStream myss; public: SerialComm(int argc, char** argv) { myss = new LibSerial::SerialStream("/dev/ttyS0", ios_base::out); myss.SetBaudRate(LibSerial::SerialStreamBuf::BAUD_57600); myss.SetCharSize(LibSerial::SerialStreamBuf::CHAR_SIZE_8); myss.SetFlowControl(LibSerial::SerialStreamBuf::FLOW_CONTROL_NONE); myss.SetParity(LibSerial::SerialStreamBuf::PARITY_NONE); myss.SetNumOfStopBits(1); const int Dsize = 2; char buffer[1]; buffer[0] = 125; //0b00000001; buffer[1] = '\0'; bitset(buffer[0]); //myss << buffer; myss.write(buffer,1); //myss.Close(); } } 
0
source

All Articles