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;