Go Down

Topic: Write list from Raspberry pi(Python) to Arduino (Read 328 times) previous topic - next topic

Hatmpatn

Hello! I have this list in python:

Code: [Select]
[331, 364, -41, 178, 270, -45, 276, 247, -39]

And I want to transfer it from the Raspberry pi to the Arduino. They are connected through Serial.

I want the program to do the following:

-Raspberry pi shall wait for the word "start" from Arduino
-Send text "start" from Arduino to the Raspberry pi
-The Raspberry pi shall perform actions which generates my list above.
-The Raspberry pi send the list to Arduino.

Right now I have managed to get the Arduino to send the word "start" to the Raspberry pi, but I cant get the Raspberry pi to respond back with the list.

The Python code:

import time
import math
import serial
from time import sleep

ser=serial.Serial('/dev/ttyS0',9600,timeout=1)

#wait for green light from arduino
while loop:
    while ser.readline() != b'start':
        time.sleep(1)

springs.append(maxDT[1])
                    springs.append(maxDT[0])
                    springs.append(theta)

Robin2

Don't double Post. I have already replied to your other Thread.

I am suggesting to the Moderator to merge them

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

ron_sutherland

Serial is not on /dev/ttyS0 as far as I have seen.

You are going to have to tell us how you have connected the serial. For example, the R-Pi has hardware serial (/dev/ttyAMA0) but you have to enable it with the raspi-config tool to use it. Some use a USB serial bridge (/dev/ttyUSB0), and some connect to an Arduino Uno (/dev/ttyACM0).
I use an R-Pi Zero on an RPUpi shield to have a tool-chain at the network edge.

Hatmpatn

Don't double Post. I have already replied to your other Thread.

I am suggesting to the Moderator to merge them

...R
It is not I who have started this thread, must be a moderator. And as far as I can see the old thread is now gone. I know I got a really good answer from someone who suggested I should take a look at some threads with python arduino demo, but now I cant seem to find it?

I am certain that the serial address is the correct one. It is connected via RX TX pins and a logic level converter.

AWOL

It is not I who have started this thread, must be a moderator.
Mods seem to be taking a lot of blame for stuff these days. {sigh}

No, mods can move, delete or edit posts, but they cannot spoof authorship.

Hatmpatn

#5
Dec 14, 2018, 10:59 pm Last Edit: Dec 14, 2018, 11:03 pm by Hatmpatn
Mods seem to be taking a lot of blame for stuff these days. {sigh}

No, mods can move, delete or edit posts, but they cannot spoof authorship.
Hehe, sry, I could have used a better choice of word. I meant move.

I found the links Robin2 sent me. Thanks Robin2!

https://forum.arduino.cc/index.php?topic=225329.0
https://forum.arduino.cc/index.php?topic=288234.0

Go Up