The question is general... in case I wanna have more outputs from the Arduino Serial Monitor, e.g. want to write "Serial.print("I am fine");" or "Serial.print(some variable);" inside arduino void loop, then I will have problem in processing for the switch button function/mode, because data is tranferred is now different. What do I do in such a case?????
Leilektsoglou You might be able to get processing to look for a specific type of information coming across the serial port. For example, for each value, maybe you insert a character right before it, so processing knows that after it receives that character, it can expect to get the new value of interest.
And moreover (not talking about Serial.print command in the Arduino sketch now), let's suppose the following: Processing: if(myPort.available()>0){ val1 = myPort.read(); // I know it's not right but I show you what I want val2 = myPort.read(); ................................... } for an Arduino sketch like that: if(digitalRead(switchPin1)==HIGH) { Serial.write(1); } else Serial.write(0); if(digitalRead(switchPin2)==HIGH) { Serial.write(3); } else Serial.write(4); How would the code be??
Leilektsoglou So you want to trigger different events that generate similar values (HIGH/LOW) on different input pins so that the action could differentiate between those events? I think your approach can work if you use different numbers for each events, in this case you can map those e.g. in the draw function to different actions. Or you can just use a multidimensional array where you store boolean values mapping the states of different events and query in another function.
fulesmackofule How could we understand which value we send via the Serial.write() command goes to the one or another variable we want to(val1 or val2) ???
HI, How can I send some data from MATLAB Simulink (serial send) and recive that value in processing? Totally indeed a float or an integer. I am using virtual serial port, for example COM1 for simulink serial configuration and COM2 for processing.
Hello. I'm new to all this and I'm trying to understand how to send a data byte in binary that I would enter at the serial monitor and send to my Mega. I am trying to access and execute a file that is on an SD shield. (sparkfun)
OH! ... and when I run the prog on the Arduino, and open the serial monitor, .. it draws squares across the screen.... ???????? and still, .. nothing happens when the button is pressed.......
very very nice!!!thx just one question how did you do to get your serial usb port connected to arduino being usbmodem1411? your iOS is Yosemite? because in general we have to make a manipulation which provide a usb serial port being something like ch43usb....!!!!this is very problematik for working with arduino and simulink! best regards
Hi Tony Sznabel , at the time this video was shot I think I was using OSX Mavericks? I now have Yosemite and I am connecting on a serial port that is named like this... /dev/cu.usbmodem142331 My Arduino version is 1.6.6
Hi, my problem is, .. it's not working. ... I copied & sent the program to the Arduino, it was happy & accepted it, .. then ran the Processing program & got no colour change, .. no anything, .. it just didn't work for me. I have tried several momentary buttons, ... & I even tried a direct 5 volts Pin to pin 4 (with the resistor in place to gnd of corse), & still, ... I get nothing, ... no colour change, .. nothing happens. ..... H.E.L.P.
@Open Source Hardware Group Thanks for the videos! I was able to hook up my arduino to processing quite easily because of these videos. I made an applet in processing that constantly read the analogRead from the arduino (linked to a potentiometer), and based on the reading, the background color of my applet would change. It's very reliable and responsive. Have you any idea how perhaps 2 separate potentiometers could be read in separately to processing? I suppose that's the same as asking whether 2 kinds of Serial.write(); could be distinguished by the Processing software.. if it wasn't restricted to reading in only numbers between 0-255 it would be easier to hack a way to distinguish with the same Serial.write(). I realized that I could make a game with a controller with this technology.. a crazy thought :).
So glad the video could help and nice work on getting setup so quick! I think it can a lot of fun to do, especially once you get a hang of processing, it is pretty fun mess around with.
Open Source Hardware Group It sure is. I posted a question above under my comment (under the 'show more' button), I would be grateful if you can see if you have an easy solution. The way youtube has it now, sometimes the 'show more' doesn't even pop up.. sigh.
Hi Woodrow Jedi, you are right, I had not seen the "read more"! To answer your question, since the serial port sends information piece by piece, you can't necessarily send two values "in parallel", but you could send two different values one after another (e.g. controller move left button, controller move right button) as long as processing knows how to parse the incoming data.
I have checked & double checked everything, ..... One momentary switch,- working, .... One 10K resistor, .. brown black orange. ... 3 jumper leads checked. One problem I HAVE found is the .. "if - else", statements in my Arduino IDE window, .. do NOT change colour. ... I have run the compiler, and it finds NO faults, ... I am now, .. well confused. .???????????
If you are on Windows, instead of writing String portName = Serial.list()[0]; myPort = new Serial(this, portName, 9600);, you just have to write for example myPort = new Serial(this,"COM3", 9600); It works for me, just put your COM number in there.
how do i make the arduino read strings of data? like "LED1ON" "LED2OFF" in an if statement? and make the arduino cotroll multiple servos then i need to send "servoone180" how do i code that im getting error codes of conversion errors that i cant solve :/ please help *EDIT:* so its allready answeared here th-cam.com/video/BnjMIPOn8IQ/w-d-xo.html
thanks for taking time 2 make videos
Many many thanks for your very amazing training videos. As a subscriber, I am following your new training videos. I hope to see more.
Thanks!
Great video series!!!! Keep up the good work, very helpful for those who are starting out with the arduino platform!!!
Thank you! I am glad they are helping.
nailed it!, great tut, clear easy to understand!
Iam working on project at the moment. The idea is to play a video in Processing and trigger by PIR sensor. Do you think is that possible?
mate your VIDS ARE AWESOME!
The question is general... in case I wanna have more outputs from the Arduino Serial Monitor, e.g. want to write "Serial.print("I am fine");" or "Serial.print(some variable);" inside arduino void loop, then I will have problem in processing for the switch button function/mode, because data is tranferred is now different. What do I do in such a case?????
Leilektsoglou You might be able to get processing to look for a specific type of information coming across the serial port. For example, for each value, maybe you insert a character right before it, so processing knows that after it receives that character, it can expect to get the new value of interest.
Open Source Hardware Group Could you give an example code to better understand what you are talking about?
Thanks in any case...
And moreover (not talking about Serial.print command in the Arduino sketch now), let's suppose the following:
Processing:
if(myPort.available()>0){
val1 = myPort.read(); // I know it's not right but I show you what I want
val2 = myPort.read();
...................................
}
for an Arduino sketch like that:
if(digitalRead(switchPin1)==HIGH)
{
Serial.write(1);
}
else Serial.write(0);
if(digitalRead(switchPin2)==HIGH)
{
Serial.write(3);
}
else Serial.write(4);
How would the code be??
Leilektsoglou So you want to trigger different events that generate similar values (HIGH/LOW) on different input pins so that the action could differentiate between those events? I think your approach can work if you use different numbers for each events, in this case you can map those e.g. in the draw function to different actions.
Or you can just use a multidimensional array where you store boolean values mapping the states of different events and query in another function.
fulesmackofule How could we understand which value we send via the Serial.write() command goes to the one or another variable we want to(val1 or val2) ???
HI,
How can I send some data from MATLAB Simulink (serial send) and recive that value in processing? Totally indeed a float or an integer.
I am using virtual serial port, for example COM1 for simulink serial configuration and COM2 for processing.
can we use UART between 2 arduinos and the USB from one MCU "master" connected to the pc? "visual studios" vua com port "usb"
Hello. I'm new to all this and I'm trying to understand how to send a data byte in binary that I would enter at the serial monitor and send to my Mega. I am trying to access and execute a file that is on an SD shield. (sparkfun)
OH! ... and when I run the prog on the Arduino, and open the serial monitor, .. it draws squares across the screen.... ???????? and still, .. nothing happens when the button is pressed.......
very very nice!!!thx
just one question
how did you do to get your serial usb port connected to arduino being usbmodem1411?
your iOS is Yosemite?
because in general we have to make a manipulation which provide a usb serial port being something like ch43usb....!!!!this is very problematik for working with arduino and simulink!
best regards
Hi Tony Sznabel , at the time this video was shot I think I was using OSX Mavericks? I now have Yosemite and I am connecting on a serial port that is named like this... /dev/cu.usbmodem142331
My Arduino version is 1.6.6
Hi, my problem is, .. it's not working. ... I copied & sent the program to the Arduino, it was happy & accepted it, .. then ran the Processing program & got no colour change, .. no anything, .. it just didn't work for me.
I have tried several momentary buttons, ... & I even tried a direct 5 volts Pin to pin 4 (with the resistor in place to gnd of corse), & still, ... I get nothing, ... no colour change, .. nothing happens. ..... H.E.L.P.
Hi +Mike M, If you don't turn on Processing, but use Serial.print() in the Arduino sketch, is any information going to the Serial.monitor window?
Why don't we have to call the serialEvent(Serial port) function in processing?
@Open Source Hardware Group Thanks for the videos! I was able to hook up my arduino to processing quite easily because of these videos. I made an applet in processing that constantly read the analogRead from the arduino (linked to a potentiometer), and based on the reading, the background color of my applet would change. It's very reliable and responsive.
Have you any idea how perhaps 2 separate potentiometers could be read in separately to processing? I suppose that's the same as asking whether 2 kinds of Serial.write(); could be distinguished by the Processing software.. if it wasn't restricted to reading in only numbers between 0-255 it would be easier to hack a way to distinguish with the same Serial.write().
I realized that I could make a game with a controller with this technology.. a crazy thought :).
So glad the video could help and nice work on getting setup so quick! I think it can a lot of fun to do, especially once you get a hang of processing, it is pretty fun mess around with.
Open Source Hardware Group It sure is. I posted a question above under my comment (under the 'show more' button), I would be grateful if you can see if you have an easy solution. The way youtube has it now, sometimes the 'show more' doesn't even pop up.. sigh.
Hi Woodrow Jedi, you are right, I had not seen the "read more"!
To answer your question, since the serial port sends information piece by piece, you can't necessarily send two values "in parallel", but you could send two different values one after another (e.g. controller move left button, controller move right button) as long as processing knows how to parse the incoming data.
I have checked & double checked everything, ..... One momentary switch,- working, .... One 10K resistor, .. brown black orange. ... 3 jumper leads checked.
One problem I HAVE found is the .. "if - else", statements in my Arduino IDE window, .. do NOT change colour. ... I have run the compiler, and it finds NO faults, ...
I am now, .. well confused. .???????????
If you are on Windows, instead of writing String portName = Serial.list()[0]; myPort = new Serial(this, portName, 9600);, you just have to write for example myPort = new Serial(this,"COM3", 9600); It works for me, just put your COM number in there.
THANKS FOR NOT DOING THAT BLINKING LED TRICK. ILL GIVE THIS A TRY.
how do i make the arduino read strings of data? like "LED1ON" "LED2OFF" in an if statement?
and make the arduino cotroll multiple servos then i need to send "servoone180" how do i code that im getting error codes of conversion errors that i cant solve :/ please help *EDIT:* so its allready answeared here th-cam.com/video/BnjMIPOn8IQ/w-d-xo.html
watching videos just for the sake of intro music.
forget this there is no code exept typing it from this disorganized video