We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I'm using G4P Library and I want to add Arduino code in my sketch but I can't. I'm using VSPE and Proteus for the Arduino UNO.
Can you help me to add this code to the win_draw1 ? It's for the temperature. I'm sorry for the french code, if you can help me with Skype (in live) it's cool.
Regards, Itachi
Answers
You already have code in this method but assuming you want the output from the second sketch to appear in that window, try this.
In the second Processing code block all the drawing is done in setup lines 26-77 so copy these lines into the win_draw1 method and prefix all the drawing commands with
appc.
That's what I do for the appc. ! Of course. How can I do to add the void serialEvent to the win_draw1 ?
I can do screenshot if you want. The interface : http://prntscr.com/acd4fk ISIS Proteus : http://prntscr.com/acd4qx
I want just to adapt the temperature to this code and when I up the temperature in Proteus, the temperature UP in the interface. It's so hard with G4P ^_^
Thanks
Serial library searches for serialEvent() method from the passed PApplet instance parameter.
Like that : synchronized public void serialEvent (PApplet appc, GWinData data) ?
serialEvent()'s signature is always:
void serialEvent(Serial)
.How can I do to add the (Serial) and the (PApplet [...]) ? ^_^ for the win_draw1
If you change the serialEvent method then you don't need to add the serialEvent method to appc.
So here is the modified method
All the drawing code based on the temperature calculated (
f_temperature
) in the serialEvent method is now placed in win_draw1Notice I have created a new global variable (
f_temperature
) because you already have one calledtemperature
although you don't appear to use it.When I add the code to the win_draw1 I've got an error.
"unexpected token: void"
Can you adapt this code ? I have to do that with the humidity, If I see how you do the temperature, I can do the humidity alone.
Thanks for you help
This code will be in the main sketch tab
This code is the win_draw1 in the gui tab.
Notice that the variable f_temperature is modified in the serialEvent method and used in the win_draw1 method.
Nice, my sketch run.
But now I'm testing if the temperature can UP or down with Isis Proteus (+ the code Arduino...) and she doesn't work.
I have to rename the variable temperature for f_temperature in the Arduino code ?
Remove line 60, you are creating a local version of f_temperature which hides the global version.
Alternatively change line 55 to
and delete all statements
float f_temperature;
It works, really thank you. I'll try the side of moisture and ground now.
Do you know what is the line I have to add to have the temperature value displayed on the curve is displayed in text, for example : 15 ° ?
Not sure what you mean by "on the curve" since I can't run your sketch to try it out. You have something close in line 109 which displays a temperature
Sorry, I mean : I want to display the temperature in text. Here it's the thermometer | Here the temperature : 15°
I don't know if this is what you mean -
appc.text("Here the temperature : "+ temperature + "˚", poxX, posY);
Where posX posY is the position on the curve
Yes, it's good thank you !
How can I do to add a text to an image ? I tried several methods and I found nothing... Like that : http://prntscr.com/acqjp3
You can't add text to a PImage object.
Okay... I'm going to add this picture to the background. Thank's.
Hi,
I have to display a value on my interface from a real Arduino assembly, or when I add value to A2, the A1 value appears, the problem come to my void serial Event or Arduino code ?
**My Arduino code **:
Regards, Itachi
https://forum.Processing.org/two/discussion/8082/from-several-variables-to-arrays
Do you have an exemple ?
I have that :
And I want now to do that for the humidity but without the A1, I have in my Arduino code an others analogRead like A2, A3, A4...
Regards,
https://forum.Processing.org/two/discussion/14988/drawing-of-graphs-from-i2c-imu
I did several tests since your reply and that does not work. Can you help me to add a new value, I use potentiometer.
My Arduino code :
My Processing code :
As you can see, I do simulation for the temperature, now I want to add 4 others values. I don't know if I have to add new void serialEvent, I try with Firmata for Arduino but it doesn't work too. Can you help me to add 4 others values ? You can do an exemple for 2 values ? I think I can do for the others if I have a good exemple.
Thanks for you help, it's for my project and I have to finish that for the 18/05.
Regards.
UP
I try with that :
I have the temperature and the height, but I want only the temperature when I'm in A0, and only the height when I'm in A1 with Arduino.
My Arduino code :
Thx ^_^
I don't think that the problem is with G4P any more, it is really about using Arduino. Perhaps it might be useful to either edit the discussion title or, because or ctreate a new discussion that focuses on this problem.
Unfortunately I have never used Arduino so I can't really help.
No problem, I'm going to do a new thread.