Can Arduino Call Functions Besides cayenne.loop?

can you try the same code with it.

I will give it a shot in a little while

Raspberry Pi Certified Educator

Pi-Top Certified Learning Designer

West Hollow Middle School

Half Hollow Hills CSD

Twitter and Instagram: @reginius214

Web: www.reginiusscience.com

Success! When I switched over to the Mega I am able to establish a connection to Cayenne, read locally from the LCD, and activate my ISR. Why do you suppose this is so?

A couple of quirks however. The analogRead of the pot on A0 is a lot more jumpy than on the Uno. Also, the connection keeps breaking and reconnecting which is resetting the Arduino. This requires a recalibration each time it resets. Thoughts on connection
instability?

Raspberry Pi Certified Educator

Pi-Top Certified Learning Designer

West Hollow Middle School

Half Hollow Hills CSD

Website: https://www.reginiusscience.com

Twitter: https://twitter.com/reginius214

Instagram: https://www.instagram.com/reginius214/

i tired your code and the code almost used the entire memory which may be one of the reason.

how do you come to know this?

I can see the prompt in the terminal window that I have open on the Pi.

Raspberry Pi Certified Educator

Pi-Top Certified Learning Designer

West Hollow Middle School

Half Hollow Hills CSD

Website: https://www.reginiusscience.com

Twitter: https://twitter.com/reginius214

Instagram: https://www.instagram.com/reginius214/

can you share the entire output here?

Image

Output from terminal during disruption.

Raspberry Pi Certified Educator

West Hollow Middle School

Half Hollow Hills CSD

Twitter and Instagram: @reginius214

Web: www.reginiusscience.com

Do you get the same issue with basic example code.

It’s sporadic. Seemed to be a bit more prevalent when I made the switch to the Mega. Could this be from a weak network connection?

Raspberry Pi Certified Educator

West Hollow Middle School

Half Hollow Hills CSD

Twitter and Instagram: @reginius214

Web: www.reginiusscience.com

open Cayenne-MQTT-Arduino/extras/scripts/cayenne-ser.sh file. scroll down to bottom and edit:

while [ 1 ]; do
    echo Connecting: "$FROM_ATTR <-> $TO_ATTR"

    socat $GEN_ATTR $FROM_ATTR $TO_ATTR

    detect_conflicts

    echo Reconnecting in 3s...
    sleep 3
done

to

while [ 1 ]; do
echo Connecting: “$FROM_ATTR <-> $TO_ATTR”

socat -t 10 $GEN_ATTR $FROM_ATTR $TO_ATTR

detect_conflicts

echo Reconnecting in 3s...
sleep 3
done

you can also try these different timeout values (-t 60, 120, 300)

What will this modification do? Are there potential consequences?

Raspberry Pi Certified Educator

West Hollow Middle School

Half Hollow Hills CSD

Twitter and Instagram: @reginius214

Web: www.reginiusscience.com

the error you are getting is EOF End-of-file It means the socket has no more data to read. When one channel has reached EOF, the write part of the other channel is shut down. Then, socat waits [timeval] seconds before terminating. Default is 0.5 seconds. This timeout only applies to addresses where write and read part can be closed independently. When during the timeout interval the read part gives EOF, socat terminates without awaiting the timeout.

1 Like

This would make sense as to why I was getting the EOF during my calibration ISR when there would be no writing out to cayenne correct? Presumably I can modify the timeout to carry me through that process and it should prevent resetting?

Raspberry Pi Certified Educator

West Hollow Middle School

Half Hollow Hills CSD

Twitter and Instagram: @reginius214

Web: www.reginiusscience.com

Give it a try and let me know if the issue is solved.

I will be away on vacation until next Friday. I will be able to test it then and give you some feedback about the solution. Thank you so much for your guidance thus far.

Raspberry Pi Certified Educator

West Hollow Middle School

Half Hollow Hills CSD

Website: https://www.reginiusscience.com

Twitter: https://twitter.com/reginius214

Instagram: https://www.instagram.com/reginius214/

1 Like

It appears that modifying the socat timeout value to 60 has done the trick. Thank you so much for all your guidance. I will revisit the discussion if any other issues arise.