I am trying to build a project that uses the sensors in a smartphone (gyro, acceleration, magnetometer, etc.), sends them to the Arduino MEGA and causes a rotation on the motor (speed and direction are tied to angle).
I found a project that uses wifi to connect the Arduino to the phone, but I want to use a direct connection. GitHub - Nurgak/Smartphone-sensor-data-collection-application: Android application for internal and external sensor reading over WiFi using the USB host feature and a connected device
How would I go about this?
Can I connect the smartphone the Arduino Mega via an OTG cable directly to the USB port?
Would I have to write a code for the phone to send its data to the Arduino?
Any resources you can provide to help out would be very much appreciated!