set activity/ inactivity thresholds (0-255)Īdxl.setActivityThreshold(75) //62.5mg per incrementĪdxl.setInactivityThreshold(75) //62.5mg per incrementĪdxl.setTimeInactivity(10) // how many seconds of no activity is inactive? Serial.begin(9600) //Initialise the serial connection Int TX_PIN = 11 // Tell Arduino on which pin you would like to Transmit data NOTE should be a PWM Pin Int ledPin = 13 //a sign when the transmitter is working And here's the transmitter's code: /* Code for the transmitter of the mind controlled bot */ĪDX元45 adxl //variable adxl is an instance of the ADX元45 library The sensor outputs data in the range 0-255 when titlted forward or left side, and -255 to 0 when titled backwards or right side. Here's the serial monitor reading out values (in the attached image). If (receivedData.TX_ID = RX_ID) //Check if the radio signal recieved matches the ID of the Reciever If (vw_get_message((uint8_t *)&receivedData, &rcvdSize)) // Check if data is available Vw_wait_rx() // Start to Receive data now Uint8_t rcvdSize = sizeof(receivedData) //Incoming data size Vw_setup(2000) // Setup and Begin communication over the radios at 2000bps( MIN Speed is 1000bps MAX 4000bps) Int y1 // Initialize a storage place for the Second integar that you wish to Send Int x1 // Initialize a storage place for the first integar that you wish to Send Int TX_ID // Initialize a storage place for the outgoing TX ID Typedef struct roverRemoteData// Data Structure Int RX_PIN = 11 // Tell Arduino on which pin you would like to receive data NOTE should be a PWM Pin I'm doing you a favour and posting in code tags like you should have: /* Mind controlled car - Car's code */
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |