I'm cross-posting this with the arduino exchange because i'm not sure if it's a problem with my C or something else entirely.
I'm attempting to communicate over wifi using the process library (Part of the arduino yun's librarys) And I'm calling the same functions in the same way in two programs. One program works the other doesn't.
These are the functions:
Process p; // Create a process and call it "p"
p.begin("curl"); // Process that launch the "curl" command
p.addParameter(b); // Add the URL parameter to "curl"
p.run(); // Run the process and wait for its termination
Console.flush();
Console.println("CurlSetup");
while (p.available() > 0) {
//Stuff
}
I have successfully called the functions once in my more complicated program but ran into trouble when I tried using the functions twice. I then found the example of using these functions in the IDE and changed it slightly to run the functions twice in the program (to mirror my own program).
My code console printout:
Create String:http://ift.tt/1E69hs4
"102N"
1Nodeid: 102
Nodeid: 102
0
apikey=xxxx
&node=102
&json=0x0201,0x0000,0x019,0x0
http://ift.tt/1SHLUkD
Breaks
Here
http://ift.tt/1SHLUkH
http://ift.tt/1E69hs6
http://ift.tt/1SHLUkJ
CurlSetup
Just to clarify, this should produce a much larger print out. My program just stops and crashes at this point. The print out of a successful run through would be 2-3 times longer than this.
Modified working example printout:
Unable to connect: retrying (1)...
Unable to connect: retrying (2)... connected!
`:;;;,` .:;;:.
.;;;;;;;;;;;` :;;;;;;;;;;: TM
`;;;;;;;;;;;;;;;` :;;;;;;;;;;;;;;;
:;;;;;;;;;;;;;;;;;; `;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; .;;;;;;;;;;;;;;;;;;;;
;;;;;;;;:` `;;;;;;;;; ,;;;;;;;;.` .;;;;;;;;
.;;;;;;, :;;;;;;; .;;;;;;; ;;;;;;;
;;;;;; ;;;;;;; ;;;;;;, ;;;;;;.
,;;;;; ;;;;;;.;;;;;;` ;;;;;;
;;;;;. ;;;;;;;;;;;` ``` ;;;;;`
;;;;; ;;;;;;;;;, ;;; .;;;;;
`;;;;: `;;;;;;;; ;;; ;;;;;
,;;;;` `,,,,,,,, ;;;;;;; .,,;;;,,, ;;;;;
:;;;;` .;;;;;;;; ;;;;;, :;;;;;;;; ;;;;;
:;;;;` .;;;;;;;; `;;;;;; :;;;;;;;; ;;;;;
.;;;;. ;;;;;;;. ;;; ;;;;;
;;;;; ;;;;;;;;; ;;; ;;;;;
;;;;; .;;;;;;;;;; ;;; ;;;;;,
;;;;;; `;;;;;;;;;;;; ;;;;;
`;;;;;, .;;;;;; ;;;;;;; ;;;;;;
;;;;;;: :;;;;;;. ;;;;;;; ;;;;;;
;;;;;;;` .;;;;;;;, ;;;;;;;; ;;;;;;;:
;;;;;;;;;:,:;;;;;;;;;: ;;;;;;;;;;:,;;;;;;;;;;
`;;;;;;;;;;;;;;;;;;;. ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;; :;;;;;;;;;;;;;;;;:
,;;;;;;;;;;;;;, ;;;;;;;;;;;;;;
.;;;;;;;;;` ,;;;;;;;;:
;;; ;;;;;` ;;;;: .;; ;; ,;;;;;, ;;. `;, ;;;;
;;; ;;:;;; ;;;;;; .;; ;; ,;;;;;: ;;; `;, ;;;:;;
,;:; ;; ;; ;; ;; .;; ;; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.2</center>
</body>
</html>
It also breaks either the arduino or the IDE. After running my code and trying to upload more code to the arduino, I get the following error:
avrdude: verification error, first mismatch at byte 0x0000
0xff != 0x0c
avrdude: verification error; content mismatch
In the IDE and it refuses to upload the code to the arduino.
My code, Ip's and Apikey's blanked out: http://ift.tt/1E69hsa
Modified arduino example code: http://ift.tt/1SHLUkN