Really simplified passing javascript variable to processing.js not working
in
Processing with Other Languages
•
3 months ago
Right,
I am really trying to walk before I can run but still cant get this to work
I have this html file with what seems to me to be valid javascript
I am really trying to walk before I can run but still cant get this to work
I have this html file with what seems to me to be valid javascript
- <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My Processing Page</title>
<script type="text/javascript" src="processing-1.4.1.min.js"></script>
<script type="text/javascript">
instance = Processing.getInstanceById('JSON_Test');
instance.GetWebData(10.0,11.0,1,2,3,1234567,6,"This is a test");
</script>
</head>
<body>
<canvas id="JSON_Test" data-processing-sources="JSON_Test.pde"></canvas>
</body>
</html>
and this pde file with a function called GetWebData
- float PanelTemp;
float PoolTemp;
int ControllerMode;
int SetTempInc;
int PanelCriticalTemp;
long CumulativePumpRuntime;
int PumpsOnOff;
String StatusText;
void setup()
{
size(320, 460);
smooth();
}
void draw()
{
text(PanelTemp + ", " + PoolTemp + ", " + ControllerMode + ", " + SetTempInc + ", " + PanelCriticalTemp + ", " + CumulativePumpRuntime + ", " + PumpsOnOff + ", " + StatusText,40,50);
}
void GetWebData(float field1, float field2, int field3, int field4, int field5, long field6, int field7, String status)
{
PanelTemp = field1;
PoolTemp = field2;
ControllerMode = field3;
SetTempInc = field4;
PanelCriticalTemp =field5;
CumulativePumpRuntime = field6;
PumpsOnOff= field7;
StatusText = status;
}
And all I am trying to do is to pass this string 10.0,11.0,1,2,3,1234567,6,"This is a test" into the pde file so it will print on the screen!
Can I bugger get this to work. The problem is in the fact there are absolutely no bog basic idiot proof tutorials on how to do this. even pomax's jumps around and doesnt provide zip files with the working code for you to hack at
Please can someone help
Can I bugger get this to work. The problem is in the fact there are absolutely no bog basic idiot proof tutorials on how to do this. even pomax's jumps around and doesnt provide zip files with the working code for you to hack at
Please can someone help
1