Go Down

Topic: Control servos through app trouble (Read 2242 times) previous topic - next topic

WallAppAlpha

here is what im getting in the serial monitor

AWOL

here is what im getting in the serial monitor
Text please, not nearly 2MB of image.

WallAppAlpha

here is a screen shot it just keeps running these random digits

cattledog

Thank you for the image and the animation. I see what you are experiencing, but don't understand the cause.

You said that the simple iphone/BT-HM10/Trinket blink code in post #23 worked properly. You did not see the "spam" behaviour.

Can you still run that simple sketch with the app behaving properly? If not, then something in an app setting may have changed.

If the bluetooth blink sketch runs but the servo sketch doesn't, we can sequentially add small pieces of the servo code back in to see what broke.

You may also want to try a different iphone BLE terminal app. Is this what you are currently running?
https://itunes.apple.com/us/app/hm10-bluetooth-serial-pro/id1221924372?platform=iphone&preserveScrollPosition=true#platform/iphone

Unfortunately, I live in Android world, and don't have an iphone to help test anything. I'm also more familiar with BT classic and don't know if there is anything in the BLE protocols that can cause this.

Good Luck.

WallAppAlpha

do you think it was the loop? i dont think its an apple thing it seems to single down to the code the blink test workder great but ill will test things out and see what happens

cattledog

Quote
do you think it was the loop?
I really don't see how the code can be interactive with the app, but for now there is a mystery. The most important this is to get back to something that works and we can build on.

Unfortunately, I thought we did that after the first blink code success.  :( 

WallAppAlpha

#51
Aug 11, 2018, 12:14 am Last Edit: Aug 11, 2018, 12:22 am by WallAppAlpha
I don't have it independently powered yet so I plug it in via the USB do you think I'm getting serial interference or may that be the reason I get the extra data? I just ran the code and it works its just really laggy due to the random serial digits


or do you think possibly the timmer at the bottom is the one producing the data and lagging up my program?

cattledog

Quote
I don't have it independently powered yet so I plug it in via the USB do you think I'm getting serial interference or may that be the reason I get the extra data?
I'm not totally familiar with the Trinket, but here the reference on the pinout
https://learn.adafruit.com/introducing-trinket/pinouts

The soft servo libary sets the usb pins to outputs, so it should be OK
Quote
USB Pins
The next 2 pins are also used for USB programming. That means that when the Trinket is connected to a computer and in bootloader mode or in the middle of uploading a new program, they are used for sending data to/from the computer! It's possible to share these pins if you are careful. The best use of these pins is as outputs to things like LEDs. We didn't want to keep these pins off the board but we strongly recommend not using them unless you're sure you need them since you might have to disconnect any connections to reprogram the Trinket!
It's certainly worth trying to power the Trinket not through the USB connector. Or, just modify a usb cable to only contain power and ground (or perhaps a cell phone charging cable might only have the two wires).

Quote
I just ran the code and it works its just really laggy due to the random serial digits
I asked you to run the blink code. Is it now "laggy" and showing the mystery screen output?

Quote
do you think possibly the timmer at the bottom is the one producing the data and lagging up my program?
You seem to be getting ahead of yourself. The timer code should not be in the blink code.

If the blink code works without "spam" the timer can be the first thing put back in. If the blink code runs with spam we'll need to back up a bit to find out why. The app should not be producing extra data.

 

WallAppAlpha

Sorry I meant that the blink code ran fine but as I ran my code for the servos they tended to run laggy due to the extra data being transmitted ik going to try with an independent power source I feel that that is the root of the problem because my code works and is responsive just laggy and the BT issue

cattledog

Quote
the blink code ran fine but as I ran my code for the servos they tended to run laggy due to the extra data being transmitted
Great you now have a place to start and you add back small pieces of the servo code until something breaks. Keeps us informed about what you find.

It certainly can't hurt to try an independent power source. If one end of the usb cable is into the Trinket, what is the other end currently attached to? What is downloading the program to the Trinket when you are in boot mode? Is it by any change an ipad, iphone, or a Mac terminal which is also running the wireless BT?

For clarity, and perhaps some possible interaction due to reserved names in the ide, you may want to rename the Software serial instance to something like BT_Serial. However, since the blink example works with the SoftwareSerial Serial(0,1) call, it may not be the root cause of the problem.

Go Up