Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am using a chronos TI watch. The output data that i get from this code is an array of x y and z (

image text in transcribed

I am using a chronos TI watch. The output data that i get from this code is an array of x y and z ( ex:x=24 y=56 z=65) from python in rasberry pie

I want to track the variables x y and z when they are true I want it to send a true statement to an arduino.

for example when x>45 y>60 z>13 when that is true send a signal to an ardunio from a rasberry pie.

Thank you

import serial import array def start Access Point return array. array ('B', [0xFF, 0x07 0x03] .tostring def accDataRequest return array.array ('B', [0xFF, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00] tostring #Open COM port 6 (check your system info to see which port #yours is actually on #argments are 5 (COM6), 115200 (bit rate and timeout is set so the serial read function won't loop forever, COM ser serial Serial ('COM7', 9600, timeout 1) Start access point ser.write start Access Point while True #Send request for acceleration data Ser. Write (accDataRequest accel ser read (7) if ord (accel[0]) 0 and ord (accel [1]) 0 and ord (accel [2]) print "x: str (ord (accel [0])) y: str (ord (accel [1])) z: str (ord (accel [2])) ser. Close

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions