PS3 navigation controlled electric longboard troubles

Hi, this is my first post to the forum but I am having some issues trying to code my Arduino UNO to control a brushless ESC on my electric longboard via a USB shield, Bluetooth adapter and a PS3 navigation controller.

I have the setup working when the analog stick position dictates the throttle however I would like the following to happen:

When the L1 button is held and the analog stick pushed forwards, the PWM output for the ESC increases at a gradual rate and when the L1 button is held and the analog stick pushed backwards, the PWM output for the ESC to decrease at a gradual rate. This is a similar operation to the Wiiceiver created to control an electric board with a wii nunchuck with the general aim of smoother acceleration.

What actually happens:

In the code for the UNO, I have the x button controlling a toggle for a transistor which turns leds on and off which works fine however the code for the ESC does nothing but arm. On the serial read out, the anolog input is read and displayed but the speed remains the same and neither the X button or L1 button show that they have been clicked.

can someone please fix this for me as my friend and I have been working on this for 3 days now…


version_10.ino (2.56 KB)

The current code is the link below:

In the rubbish bin? A lot of us can't or won't go there. Post your code HERE, as an attachment.

I have uploaded it as an attachment now thanks :slight_smile: