Component: GameCode (Misc Circuit)

From Flowcode Help
Revision as of 18:59, 16 November 2021 by Wiki bot (talk | contribs) (Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Jef De Bruyne |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:g...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Author Jef De Bruyne
Version 1.0
Category Misc Circuit


GameCode component

A small handheld device designed for creating embedded games. Complete with a 8 x 16 LED display, 4-Way DPAD with 4 additional push switches Buzzer, Vibration, MP3 Player, Potentiometer and Lithium battery management. Programmed via USB.

Detailed description

No detailed description exists yet for this component



Examples

FC6 Icon.png GSM Example Example should show the following on the display on the panel and on the hardware.

GSMPan.jpg


The AT injector component allows us to simulate the response of the GSM module.

GSMInject.jpg




Downloadable macro reference

Fc9-comp-macro.png PlayNote
Output a single note on the buzzer. Specify the desired frequency (Hz) and duration (ms). 
Fc9-u16-icon.png - UINT Frequency
Sets the pitch for the note in Hz. Range 1-20000 Hz 
Fc9-u32-icon.png - ULONG Duration
Time period to play the note for in milliseconds. Range 0-65535 ms 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png DisplayWrite
Write an array containing 16 bytes to the display to illuminate the corresponding dots. The index represents the line (Y-axis), starting from 0 for the uppermost line. The value of the byte represents the column (X-axis), with MSB the leftmost dot. 
Fc9-u8-icon.png - BYTE Array
Index = line, Content (byte) = column 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png PotRead
Read and return the value of the potentiometer. If desired, give the upper limit to scale the output value. Enter "MaxValue = 0" to skip scaling and get the byte value (0-255) 
Fc9-u16-icon.png - UINT MaxValue
Scale the return value. Enter 0 to skip. 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png PwrLedSet
Control the PWR LED. 0 = red + green 1 = red 2 = green 
Fc9-u8-icon.png - BYTE Value
0 = red + green, 1 = red, 2 = green 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EEStoreValue
Saves a value to none volitile memory 
Fc9-u8-icon.png - BYTE Address
Address to write to, Range: 0-255 
Fc9-u8-icon.png - BYTE Value
Value to store, Range: 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png MP3PlayTrack
Plays track from the selected folder. MP3 & Advert folder track numbers should be 4 characters long e.g. "0001-anyname.mp3". Other folder track numbers should be 3 characters long e.g. "001-anyname.mp3". 
Fc9-u8-icon.png - BYTE Directory
0=Root, 01=Folder "01" - 99=Folder "99", 100=Folder "MP3", 101=Advert 
Fc9-u16-icon.png - UINT Track
Track number 1 = "001.mp3" / "0001.mp3" 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png MP3GetStatus
Returns the status of the MP3 module. 0 = module in sleep 1 = track is playing 2 = track is pauzed 3 = track is stopped 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png MP3PausePlayResetStop
Allows the current playing track to be paused, restarted or stopped. 
Fc9-u8-icon.png - BYTE Mode
0=Pause, 1=Play, 2=Reset, 3=Stop 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png MP3SendCommand
Send commands to MP3 module. Check datasheet for info. 
Fc9-u8-icon.png - BYTE Command
 
Fc9-u8-icon.png - BYTE Para1
 
Fc9-u8-icon.png - BYTE Para2
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EEReadValue
Retreives a value from none volitile memory 
Fc9-u8-icon.png - BYTE Address
Address to write to, Range: 0-255 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png DisplayWriteNumber
Show a number ranging from 000 to 999 on the display. Number is printed vertically.  
Fc9-u16-icon.png - UINT Value
Enter a number from 0 to 999. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png DisplayClear
Clear the display. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png BatteryRead
Read and return the voltage level of the battery in millivolt.  
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png LedsWrite
Set the button-leds. MSB = leftmost led LSB = rightmost led 
Fc9-u8-icon.png - BYTE Value
MSB = leftmost dot, LSB = rightmost dot 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png MP3SetVolume
Sets the volume level for the MP3 module 
Fc9-u8-icon.png - BYTE Volume
Range: 0 (min) - 30 (max) 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png DisplayBrightness
Control the brightness of the display.  
Fc9-u8-icon.png - BYTE Value
Enter value from 0 to 15 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Initializes all present hardware and communication. Place this at the very start of your code. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Sets up the GSM module. Returns 0 for OK, 255 for no reply and 254 for command fail. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SampleAccel
Samples the accelerometer 0 = no new data, 1 = new data available 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Left
Rotates the robot left - waits for the angle to be traversed before returning 
Fc9-u16-icon.png - UINT Angle
Angle to turn in degrees 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadIR
Reads an IR sensor 0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
Fc9-u8-icon.png - BYTE index
0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png LCDDrawPixel
Allows a single pixel on the LCD to be set or cleared 
Fc9-u8-icon.png - BYTE X
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE State
0=White (Off), 1=Black (On) 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ServoSetPosition
Allows one of the servo positions to be assigned 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-u8-icon.png - BYTE Position
Range 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardBitmap
Displays a monochrome bitmap read from the card on the LCD 
Fc9-u8-icon.png - BYTE X
Range 0-127 
Fc9-u8-icon.png - BYTE Y
Range 0-31 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardRecordMic
Records an audio stream on the card from the microphone 
Fc9-u8-icon.png - BYTE BitDepth
0=8-bit, 1=16-bit 
Fc9-u8-icon.png - BYTE SampleRate
Sample Rate 0=8KHz, 1=16KHz 
Fc9-u16-icon.png - UINT RecordTime
Time to record for in seconds, Range 0-65535 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardOpen
Attempts to open an existing file on the SD card 255=Error, 1=File not found, 0=Open OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Forwards
Drives the robot forwards - waits for the distance to be traversed before returning 
Fc9-u16-icon.png - UINT Distance
Distance in mm 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadBearing
Reads the compass bearing based on the degrees clockwise from magnetic north. 
[[File:]] - Return


Fc9-comp-macro.png GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
[[File:]] - Return


Fc9-comp-macro.png LCDDrawLine
Allows a single pixel width line to be drawn on the LCD 
Fc9-u8-icon.png - BYTE X1
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y1
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE X2
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y2
Y Pixel 0-31 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ServoAutoMoveToPosition
Allows one of the servo positions to move gradually to a new position 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-u8-icon.png - BYTE Position
Range 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadAllValue
Reads a single value stored from the read all command Index dictates which sensor value to read 
Fc9-u8-icon.png - BYTE Index
0=SW, 1-8=IR, 9-10=Line, 11=Light, 12=Mic, 13-15=Accel 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png LCDBacklight
Allows the LCD backlight brighntess to be adjusted 
Fc9-u8-icon.png - BYTE Intensity
Range 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png LCDDrawRect
Allows a rectangle to be drawn on the LCD 
Fc9-u8-icon.png - BYTE X1
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y1
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE X2
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y2
Y Pixel 0-31 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadLine
Reads one of the IR line sensors 0-1 0=Left, 1=Right 
Fc9-u8-icon.png - BYTE index
0=Left, 1=Right 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png ServoDisable
Allows one of the servo outputs 0-3 to be disabled 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ServoEnable
Allows one of the servo outputs 0-3 to be enabled 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardReadByte
Reads a byte from the currently open file. Starts at the beginning of the file and auto increments to the end 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardErase
Attempts to delete an existing file on the SD card 255=Error, 1=File not found, 0=Delete OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardWriteByte
Appends a byte to the end of the currently open file  
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EncoderRead
Reads one of the motor encoder counters. Approx 0.328296mm of travel per encoder unit. 
Fc9-u8-icon.png - BYTE index
0=Left, 1=Right 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png SetMotors
Sets the motor speeds without feedback Range -100 to 100 
[[File:]] - Left
Range -100 to 100 
[[File:]] - Right
Range -100 to 100 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Backwards
Drives the robot backwards - waits for the distance to be traversed before returning 
Fc9-u16-icon.png - UINT Distance
Distance in mm 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EncoderReset
Resets the motor encoder counters 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png LCDVerbose
Allows the LCD to automatically report the API commands as they get processed. Default - verbose on 
Fc9-u8-icon.png - BYTE State
0=Off 1=On 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetProp
Allows the COM port property to be set from a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-u32-icon.png - ULONG PropVal
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardInit
Attempts to startup the SD card 255=No Card, 254=Init Fail, 0=Init OK 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png LCDClear
Clears the LCD 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-1-icon.png LED On
 
Fc9-type-1-icon.png LED Off
 
Fc9-type-1-icon.png On Colour
 
Fc9-type-1-icon.png Off Colour
 
Fc9-type-1-icon.png Background Colour
 
Fc9-conn-icon.png Connections
Fc9-conn-icon.png Simulations