Maker Pro

Mind & Infra Red Controlled Robot Car

I'm building a Arduino based Robot car which is controlled by both Brain Waves & Infra Red. It is 4 wheel drive with line following sensors & a ping sensor to (hopefully) enable it to be autonomous. I'm also hoping to fit an lcd touch screen.
Status
Not open for further replies.

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
P.S. Do you know anything about Raspberry Pi & TFT LCD Screens? Ive got a raspberry Pi B & I bought a 3.5" TFT LCD screen for it. Ive got the SD card for NOOBS etc. Why is it, when I plug the screen straight onto the board, I only get a blank white screen?:mad::mad::mad::mad::mad:
Nope. I saw your thread, but can't help there.
I thought about replying to bump it back to the top, though. :D

I just replied above, too.

And you'll be surprised at how little needs to be changed to make Arduino into C.
 
Last edited:

Spike124

Aug 11, 2015
61
Joined
Aug 11, 2015
Messages
61
Right, So tonight, my mate, I'm gonna upload the graphs for you to have a look at & I'm gonna write my beginning sketch for you to have a look at for me. Just to say 'yeh, you're on the right lines' or 'F**K ME MATE! You couldn't plug a toaster in with that!'! Lol! As for the Pi screen, it's just a toy at the minute. I'm not THAT bothered. I'm focusing everything on this. I'll sort that out another day.;)
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
5:30am and I'm still awake. I realised I made a blunder with my graph. I set it up for 11 8-bit values. Turns out that only the signal strength, attention & meditation are 8-bit. All others, alpha, beta etc are 32-bit.
I 'think' that all I need to do is shift the values right 24 bits, (3 bytes), but it's hard to visualise. FFFFFFFF turns to FF. At first, I thought I had to divide, but it's not that simple.
7FFFFFFF is half of FFFFFFFF. Shifted right 24 bits, that's 7F, (127 decimal), which is half of FF, (255 decimal), so it should work.
See the need for hexadecimal (and binary operations). It's a binary shift of hexadecimal values.
Hexadecimal directly correlates to binary - 1111 binary = f hexadecimal.
That's impossible in decimal.
These bloody big numbers are a pain - FFFFFFFF = 4,294,967,295 in decimal.

By the way, I made another mistake yesterday - I forgot that C doesn't allow binary. I've been writing in PICBasic, which does allow it. C only allows hexadecimal or decimal. It's easier to work with, too.
Sorry about that.

Where I said:-
PORTB = PORTB & 0x00000001
or, put more concisely still:-
PORTB &= 0x00000001


I should have said:-
PORTB = PORTB & 0x01
or, put more concisely still:-
PORTB &= 0x01


If you go back and look at post #75, it shows the corrections there too.
Not an error with 1, but with other numbers it is.

e.g.
7 decimal = 111 binary = 7 hex
and
12 decimal = 1100 binary = 0x0c hex

Arduino language accepts binary, as well as hex, I think, but C doesn't.
Where decimal counts to 9, then steps up a digit, hex counts to f, written as 0x0f or 0x0F
0 1 2 3 4 5 6 7 8 9 a b c d e f
then
10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f

10 hex = 16 decimal
1f hex = 31 decimal

I'm looking forward to seeing your code snippet and having a go at converting it.

Anyway, having worked out how to fix my problem, I'm gonna get a few hours sleep before writing any more code.

I just double-checked. Although C doesn't, Arduino accepts binary in this form:-
PORTB &= B00000001;
or
int Num=B00100101;
 
Last edited:

Spike124

Aug 11, 2015
61
Joined
Aug 11, 2015
Messages
61
Don't worry about the mistake mate. I'm still trying to get my head around the basic commands! o_O I'm trying to upload these graphs from NeuroWave for you. Back in a min. To make it easy for me, Can you give me an email address & i'll email them to you? I've just got an apple laptop for the first time & have worked out how to video the screen but not photograph it!!!!! Bonkers! I know! And this site won't let you upload a video.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Don't worry about the mistake mate. I'm still trying to get my head around the basic commands! o_O I'm trying to upload these graphs from NeuroWave for you. Back in a min. To make it easy for me, Can you give me an email address & i'll email them to you? I've just got an apple laptop for the first time & have worked out how to video the screen but not photograph it!!!!! Bonkers! I know! And this site won't let you upload a video.
Doesn't an Apple allow a screenshot using the keyboard's "Print Screen" button? (Never used one, I'm a 'dyed-in-the-wool' IBM-compatible slave.)

And I was already going to suggest email for exchanging files etc related to this project, rather than posting them all here, and since PMs don't allow attachments.

That mistake doesn't affect your actual Arduino programming, since the Arduino accepts binary. I just thought I'd correct it because standard C doesn't allow it.

A bonus of learning C, that I forgot to mention, is that it puts you in good stead for computer programming as well. Also other micro-controllers besides Arduino. One of the big benefits of standard C is that it's 'cross-platform', (OS independent).

Off to fix my 8-bit / 32-bit bug now......
 
Last edited:

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
PM sent. Got my bug fixed, too. A 24-bit shift right worked.

A shift right in 'Processing':-

int In32bit=0x7FFFFFFF;
char Out8bit=(char)(In32bit>>24);

Results in 0x7F (127 decimal) as I'd hoped.

It can be done exactly the same in the Arduino IDE too, but with long and unsigned char. (Just checked.)
long In32bit=0x7FFFFFFF;
unsigned char Out8bit=(unsigned char)(In32bit>>24);

Simple.
I'm happy again now. :)


And my headset is due tomorrow. It arrived in the state yesterday. I can get the hack done ready for when the Arduino arrives.
Then maybe play with some PIC code to see if the hack worked OK. :cool:

So I'm even happier.
:):)
 
Last edited:

Spike124

Aug 11, 2015
61
Joined
Aug 11, 2015
Messages
61
Spike124 updated Mind & Infra Red Controlled Robot Car

I have just added photos of the (nearly) final construction! I have added a I/R obstruction avoiding sensor to the rear & have completed the 3rd level! To re-cap, 1st level contains 4 DC motors (as came with the basic kit), I/R sensor to the rear & BFD-1000 line following sensor at the front; 2nd level contains the battery box, Arduino Uno, screw shield & motor shield (V2); 3rd level contains missile style on/off switch, Arduino Mega 2560 & Mega Sensor shield V2. The 3rd level will contain the ping sensor (when it arrives). I'm getting there slowly but surely, a BIG thanks to Old Steve for ongoing help & encouragement, and a MASSIVE thanks to ESSENTRA COMPONENTS! Without their excellent products & service, I'd NEVER have got this far! Anyone needing parts, check them out! SERIOUSLY!

View updates to this showcase item...
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
I just checked out your latest progress, Spike. It's looking fantastic. Reminiscent of your London double-decker buses. :D

Now comes the fun part - the coding. :cool:

Although it's four-wheeled, I assume steering is accomplished similarly to how it's done on cars with two driving wheels and a castor - by driving the wheels on one side forwards and the pair on the other side backwards or stopped/slowed, like with Caterpillars.
 
Last edited:

FuZZ1L0G1C

Mar 25, 2014
366
Joined
Mar 25, 2014
Messages
366
I tried one of those EEG-control headsets on demo at a computer retailer....
"ERROR - NO INPUT DETECTED!!" ;)
 

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
This thread is 2 yrs old
lets close it
 
Status
Not open for further replies.
Top