I was looking on the internet at different types of robots. The usual hobby robot is controlled by a single chip, called a microcontroller. A typical microcontroller contains 8 to 32 I/O pins for sensors and/or motors. Also, the typical microcontroller is programmed by your computer via a serial port in C, C++, or Assembly... Until now! While I was searching on these robotics sites, I came upon Visual Basic-like code. Infact, I was positive it was VB code because I put it into VB and it ran! This microcontroller had VB runtimes preloaded. You don't even have to compile the EXE. Just send the module(s) and/or Class module(s) via the serial port to this special microcontroller.
The chip itself is called OOPic; Object Oriented Programmable Intergrated Circuit. I am into robotics and I am currently designing one, so when I saw this I thought "THIS IS AWESOME!!!". I looked at it even more: It can be programmed in Basic, C, Visual Basic, and Java!
OOPic - 40 pin DIP Chip, 31 Digital I/O lines, built-in Serial pins(just connect a 9-pin serial port), and much more.
Here is some example code for the OOPic:
Objects such as oDio1 are objects built onto the chip.Code:'This program used the String Basic Version of the OOPic compiler, 'which at the time of this writing is in Beta. Dim D As New oDio4 'Initializes a new object called D as a nibble I/O Dim E As New oDio1 'Initializes a new object called E as a single bit I/O Dim RS As New oDio1 'Initializes a new object called RS as a single bit I/O Dim thermo as New oI2C 'Initializes a new object called temp as an I2C port Dim thermo8bit as New oByte 'Initializes a new object called temp8bit as a 8 bit byte Dim LCD as New oDataStrobe 'Initializes a new object called LCD as a Data Strobe Sub main() 'Start of main program Call IOSetup 'Calls sub program Setup Call ThermoSetup 'Calls sub program TempSetup Call LCDSetup 'Calls sub program Configure LCD.String = "The current temp" 'Write the text to the LCD Do 'Start of do loop thermo8bit = thermo/255 'Convert 16 bit temp into 8 bit value Call SetLoc 'Calls sub program TempLoc LCD.String = STR$(thermo8bit) + "%C" 'Write the temp to the LCD Loop 'End marker for do loop End Sub 'End of main program Sub SetLoc() 'Routine to locate the cursor for the Temp RS = 0 'Sets Register Select to Control Register D = 12:Call StrobeE 'Sets the address of the degree number Hi nibble D = 06:Call StrobeE 'Sets the address of the degree number Lo nibble RS = 1 'Sets Register Select to Data Register End Sub Sub IOSetup() 'This routine sets the IO lines that are connected to the LCD display 'and configures the Virtual Circuit to do the Data Strobe. D.Iogroup = 3 'I/O group used for nibble out to LCD D.Nibble = 1 'Which nibble to use Upper or Lower D.Direction = 0 'Direction of data flow in or out E.IOLine = 27 'Which I/O line to use for Display enable and strobe E.Direction = 0 'Direction of data flow in or out E = 0 'Output value = high -- display is enabled RS.IOLine = 26 'Which I/O line to use for Register Select RS.Direction = 0 'Direction of data flow in or out RS = 0 'Output value = low -- Instruction Register LCD.Output.Link(D) 'Connect the datastrobe's data to the LCD's data I/O line LCD.Strobe.Link(E) 'Connect the datastrobe's datastrobe to the LCD's E I/O line LCD.Mode = cv4Bit 'Select 4-bit mode LCD.Operate = cvTrue ' Turn the Datastrobe object on. End Sub Sub ThermoSetup() 'Routine to setup I2C communications and Temp Co-Processor 'Temperature Co-Processor is started in 12 bit mode, the defalt state thermo.Node = 73 'Identifies node address for Temperature Processor thermo.Width = cv8Bit 'I2C object is set to 8 bit data mode thermo.Mode = cv7Bit 'I2C object is set to 7 bit address mode thermo.Value = &h51 'command to start temperature measurement thermo.Width = cv16Bit 'I2C object is set to 16 bit data mode thermo.Mode = cv10Bit 'I2C object is set to 10 bit address mode thermo.Location = &hAA 'Location of temperature registor in Temperature Processor thermo.NoInc = cvTrue 'I2C object does not auto increment the location End Sub Sub LCDSetup() 'This routine performs LCD reset and initialization and 'configures LCD display to operate in 4 bit nibble mode D = 3:Call StrobeE D = 3:Call StrobeE: ' data is 8 bits here D = 3:Call StrobeE: ' data is 8 bits here D = 2:Call StrobeE: ' data is 8 bits here D = 2:Call StrobeE: ' sets data length to 4 bits D = 8:Call StrobeE: ' sets # of display lines & font D = 0:Call StrobeE: ' sets display off D = 14:Call StrobeE: ' sets display off D = 0:Call StrobeE: ' sets display on D = 6:Call StrobeE: ' sets display on D = 0:Call StrobeE: ' entry mode set D = 1:Call StrobeE: ' entry mode set D = 0:Call StrobeE: ' entry mode set D = 12:Call StrobeE: ' entry mode set End Sub Sub StrobeE() ' This routine causes the I/O line labeled E to toggle ' one time to strobe data into LCD's internal memory E = 1 E = 0 End Sub