It's saying the error is just after the 11 but I can't figure it out please help
11 * RND(1) + 1;a
if a = 1 then let pinsb = 01110111
if a = 2 then let pinsb = 00010100
if a = 3 then let pinsb = 10110011
if a = 4 then let pinsb = 10110110
if a = 5 then let pinsb = 11010100
if a = 6 then let pinsb = 11100110
if a= 7 then let pinsb = 11100111
if a = 8 then let pinsb = 00110100
if a = 9 then let pinsb = 11110111
if a = 10 then let pinsb = 11110100
Assign binary values based on a random value:
This program was written in QB64 which supports &B prefix whereas QB45 does not.
I'm assuming that this question is about the PICAXE microcontroller and its BASIC language, because of the
[picaxe]
tag. There are several things in the posted code that won't work in PICAXE BASIC so I guess you're familiar with a different dialect or are trying to take some code written for a different dialect and use it on a PICAXE. If this isn't the case, please let us know.To get this code to work on a PICAXE you need to fix a few things:
b0
,b1
,b2
etc (byte variables) orw0
,w1
,w2
etc (word variables) unless you define another name for it using thesymbol
keyword.random
keyword which assigns a random value to the word variable you specify.if … then
command withgoto
,gosub
orexit
. Otherwise you need to use anif … then … endif
structure, but you can write this on a single line using:
to separate the commands.%
character.So I think what you're trying to do is this:
Always remember that each word variable is made up of two byte variables, so if you've used
w0
you can't also useb0
orb1
at the same time, and so on.Assign binary values based on a random value using a binary convert function reading values from data.
Assign binary values based on a random value using a binary convert function: