Let's Make Robots!

InterActive 2

AttachmentSize
InterAct2b.zip3.03 KB
InterActive2q.JPG91.66 KB
InterActive2u.JPG62.4 KB

This is an explanation of the code for the flow control I came up with it to get my Basic Stamp 2(BS2) talking to my Basic Stamp 1(BS1). I am showing the main loops only. For the code files look at letsmakerobots.com and instructables.com. Files or a zip file.

In my code I use a lot of Bit flags. Most processors allow access to the Bits of a Byte or Word to use like regular variables. Basic Stamp 1 and most Picaxe processors have defined variable names for the Bits of first few bytes of memory. Usually it is Bit0 – Bit7 or Bit0 – B15 or Bit0 – Bit31 to define a variable. In both of these processors the variable Bits can also be in another variable. Like my lights Byte B0 the Bits are the variables Bit0 – 7 that are lit1 – lit8 the individual lights. This makes testing of a light easy. “If lit1 = 1 then litOn” is simple.

The Basic Stamp 2 and processors like it use defined subscripting to access the Bits, Nibbles and Bytes of a variable. My individual lights are the variables “lights.Bit0 - Bit7”. In testing a variable Bit is “if lghts.Bit0 = 1 then litOn”. Setting is “litTmp = lights.Bit0”. Usually the subscripts can not be a variable. Look at the program files in the EasyLights article. Read your manual.

I fixed as much as I could. The BS1 doesn’t do serial out very well. It is stable and runs like any simple button on a system like this. The BS1 doesn’t do Bits very well either.

 

My flow control is the only way I got these systems to communicate.

My text comments will be // in this article. In Basic Stamp code the ' is a comment.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

This code is unstable and buggy. I am going to delete this article and put up a new one. I was excited that it worked. As soon as I fixed one thing the whole system crashed.

The editor does not allow single line spacing after a carriage return. I uploaded new pictures.

If you Shift + Enter, you will indeed get single spaces. I also believe that <code>...</code> around your code via the html button will change your code to an actual code block.