File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #masteri2c est la pour debug la communication entre l'arduino et la pi.
2+
13import smbus #type: ignore #ignore the module could not be resolved error because it is a linux only module
24import time
35import numpy as np
@@ -31,18 +33,13 @@ def read_data(length):
3133 raise ValueError ("Not enough data received from I2C bus" )
3234
3335if __name__ == "__main__" :
34- try :
35- # Send data to the slave
36- while (True ):
37- vitesse = float (input ("vitesse en millimetre par seconde:" ))
38- rotation = float (input ("rotation en degré:" ))
39- write_data (vitesse ,rotation )
40- time .sleep (0.1 ) # Wait for the slave to process the data
41- received = read_data (8 ) # Adjust length as needed
42- print ("Received from slave:" , received )
36+ while (True ):
37+ vitesse = float (input ("vitesse en millimetre par seconde:" ))
38+ rotation = float (input ("rotation en degré:" ))
39+ write_data (vitesse ,rotation )
40+ time .sleep (0.1 ) # Wait for the slave to process the data
41+ received = read_data (8 ) # Adjust length as needed
42+ print ("Received from slave:" , received )
4343
4444 # Request data from the slave
45-
46-
47- except Exception as e :
48- print ("Error:" , e )
45+
You can’t perform that action at this time.
0 commit comments