Jump to content

Component: GameCode (Misc Circuit): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(15 intermediate revisions by 3 users not shown)
Line 17: Line 17:
==Component Source Code==
==Component Source Code==


Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_GameCode_Master.fcfx FC_Comp_Source_GameCode_Master.fcfx]
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_GameCode_Master.fcfx FC_Comp_Source_GameCode_Master.fcfx]
 
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_GameCode_Master.fcfx FC_Comp_Source_GameCode_Master.fcfx]


==Detailed description==
==Detailed description==
Line 41: Line 43:




''No detailed description exists yet for this component''




Line 47: Line 48:




==Examples==




Line 53: Line 53:




''No detailed description exists yet for this component''




Line 58: Line 59:




==Examples==


''<span style="color:red;">No additional examples</span>''


==Macro reference==


===BatteryRead===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''BatteryRead'''
|-
| colspan="2" | Read and return the voltage level of the battery in millivolt. &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




 
===DisplayBrightness===
 
{| class="mtx-class-macrotable wikitable"
 
|-
 
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
 
| width="90%" class="mtx-class-macrohead" | '''DisplayBrightness'''
 
|-
 
| colspan="2" | Control the brightness of the display. &nbsp;
{{Fcfile|GSM_Test.fcfx|GSM Example}}
Example should show the following on the display on the panel and on the hardware.
 
[[File:GSMPan.jpg]]
 
 
The AT injector component allows us to simulate the response of the GSM module.
 
[[File:GSMInject.jpg]]
 
 
 
 
 
 
 
==Downloadable macro reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PlayNote'''
|-
|-
| colspan="2" | Output a single note on the buzzer. Specify the desired frequency (Hz) and duration (ms).&nbsp;
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Value
|-
|-
| colspan="2" | Enter value from 0 to 15&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Frequency
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===DisplayClear===
{| class="mtx-class-macrotable wikitable"
|-
|-
| colspan="2" | Sets the pitch for the note in Hz. Range 1-20000 Hz&nbsp;
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''DisplayClear'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| colspan="2" | Clear the display.&nbsp;
| width="90%" | Duration
|-
|-
| colspan="2" | Time period to play the note for in milliseconds. Range 0-65535 ms&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 111: Line 112:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===DisplayWrite===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisplayWrite'''
| width="90%" class="mtx-class-macrohead" | '''DisplayWrite'''
|-
|-
| colspan="2" | 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.&nbsp;
| colspan="2" | 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.&nbsp;
Line 129: Line 131:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===DisplayWriteNumber===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PotRead'''
| width="90%" class="mtx-class-macrohead" | '''DisplayWriteNumber'''
|-
|-
| colspan="2" | 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)&nbsp;
| colspan="2" | Show a number ranging from 000 to 999 on the display. Number is printed vertically. &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | MaxValue
| width="90%" | Value
|-
|-
| colspan="2" | Scale the return value. Enter 0 to skip.&nbsp;
| colspan="2" | Enter a number from 0 to 999.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===EEReadValue===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PwrLedSet'''
| width="90%" class="mtx-class-macrohead" | '''EEReadValue'''
|-
|-
| colspan="2" | Control the PWR LED. 0 = red + green 1 = red 2 = green&nbsp;
| colspan="2" | Retreives a value from none volitile memory&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Value
| width="90%" | Address
|-
|-
| colspan="2" | 0 = red + green, 1 = red, 2 = green&nbsp;
| colspan="2" | Address to write to, Range: 0-255&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===EEStoreValue===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EEStoreValue'''
| width="90%" class="mtx-class-macrohead" | '''EEStoreValue'''
|-
|-
| colspan="2" | Saves a value to none volitile memory&nbsp;
| colspan="2" | Saves a value to none volitile memory&nbsp;
Line 188: Line 193:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Initialise===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
| colspan="2" | Initializes all present hardware and communication. Place this at the very start of your code.&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MP3PlayTrack'''
|-
|-
| colspan="2" | 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".&nbsp;
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===LedsWrite===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''LedsWrite'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| colspan="2" | Set the button-leds. MSB = leftmost led LSB = rightmost led&nbsp;
| width="90%" | Directory
|-
|-
| colspan="2" | 0=Root, 01=Folder "01" - 99=Folder "99", 100=Folder "MP3", 101=Advert&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Track
| width="90%" | Value
|-
|-
| colspan="2" | Track number 1 = "001.mp3" / "0001.mp3"&nbsp;
| colspan="2" | MSB = leftmost dot, LSB = rightmost dot&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 211: Line 226:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===MP3GetStatus===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MP3GetStatus'''
| width="90%" class="mtx-class-macrohead" | '''MP3GetStatus'''
|-
|-
| colspan="2" | Returns the status of the MP3 module. 0 = module in sleep 1 = track is playing 2 = track is pauzed 3 = track is stopped&nbsp;
| colspan="2" | Returns the status of the MP3 module. 0 = module in sleep 1 = track is playing 2 = track is pauzed 3 = track is stopped&nbsp;
Line 224: Line 240:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===MP3PausePlayResetStop===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MP3PausePlayResetStop'''
| width="90%" class="mtx-class-macrohead" | '''MP3PausePlayResetStop'''
|-
|-
| colspan="2" | Allows the current playing track to be paused, restarted or stopped.&nbsp;
| colspan="2" | Allows the current playing track to be paused, restarted or stopped.&nbsp;
Line 242: Line 259:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===MP3PlayTrack===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MP3SendCommand'''
| width="90%" class="mtx-class-macrohead" | '''MP3PlayTrack'''
|-
|-
| colspan="2" | Send commands to MP3 module. Check datasheet for info.&nbsp;
| colspan="2" | 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".&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Command
| width="90%" | Directory
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | 0=Root, 01=Folder "01" - 99=Folder "99", 100=Folder "MP3", 101=Advert&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Para1
| width="90%" | Track
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Track number 1 = "001.mp3" / "0001.mp3"&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Para2
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 270: Line 283:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===MP3SendCommand===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EEReadValue'''
| width="90%" class="mtx-class-macrohead" | '''MP3SendCommand'''
|-
|-
| colspan="2" | Retreives a value from none volitile memory&nbsp;
| colspan="2" | Send commands to MP3 module. Check datasheet for info.&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Address
| width="90%" | Command
|-
|-
| colspan="2" | Address to write to, Range: 0-255&nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Para1
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | &nbsp;
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisplayWriteNumber'''
|-
|-
| colspan="2" | Show a number ranging from 000 to 999 on the display. Number is printed vertically. &nbsp;
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Para2
|-
|-
|-
| colspan="2" | &nbsp;
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Value
|-
| colspan="2" | Enter a number from 0 to 999.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 306: Line 312:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===MP3SetVolume===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''MP3SetVolume'''
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Sets the volume level for the MP3 module&nbsp;
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisplayClear'''
|-
|-
| colspan="2" | Clear the display.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Volume
|-
| colspan="2" | Range: 0 (min) - 30 (max)&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 319: Line 331:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===PlayNote===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BatteryRead'''
| width="90%" class="mtx-class-macrohead" | '''PlayNote'''
|-
|-
| colspan="2" | Read and return the voltage level of the battery in millivolt. &nbsp;
| colspan="2" | Output a single note on the buzzer. Specify the desired frequency (Hz) and duration (ms).&nbsp;
|-
|-
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Frequency
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Sets the pitch for the note in Hz. Range 1-20000 Hz&nbsp;
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LedsWrite'''
|-
|-
| colspan="2" | Set the button-leds. MSB = leftmost led LSB = rightmost led&nbsp;
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | Duration
|-
|-
|-
| colspan="2" | Time period to play the note for in milliseconds. Range 0-65535 ms&nbsp;
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Value
|-
| colspan="2" | MSB = leftmost dot, LSB = rightmost dot&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 350: Line 355:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===PotRead===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MP3SetVolume'''
| width="90%" class="mtx-class-macrohead" | '''PotRead'''
|-
|-
| colspan="2" | Sets the volume level for the MP3 module&nbsp;
| colspan="2" | 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)&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Volume
| width="90%" | MaxValue
|-
|-
| colspan="2" | Range: 0 (min) - 30 (max)&nbsp;
| colspan="2" | Scale the return value. Enter 0 to skip.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===PwrLedSet===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisplayBrightness'''
| width="90%" class="mtx-class-macrohead" | '''PwrLedSet'''
|-
|-
| colspan="2" | Control the brightness of the display. &nbsp;
| colspan="2" | Control the PWR LED. 0 = red + green 1 = red 2 = green&nbsp;
|-
|-
|-
|-
Line 379: Line 386:
| width="90%" | Value
| width="90%" | Value
|-
|-
| colspan="2" | Enter value from 0 to 15&nbsp;
| colspan="2" | 0 = red + green, 1 = red, 2 = green&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
| colspan="2" | Initializes all present hardware and communication. Place this at the very start of your code.&nbsp;
|-
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | LED Colours
| width="90%" class="mtx-class-propfolder" | LED Colours
|-
|-
|-
|-
Line 423: Line 415:
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Display Colours
| width="90%" class="mtx-class-propfolder" | Display Colours
|-
|-
|-
|-

Latest revision as of 14:36, 13 July 2026

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.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_GameCode_Master.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_GameCode_Master.fcfx

Detailed description

No detailed description exists yet for this component



Examples

No additional examples

Macro reference

BatteryRead

BatteryRead
Read and return the voltage level of the battery in millivolt.  
- UINT Return


DisplayBrightness

DisplayBrightness
Control the brightness of the display.  
- BYTE Value
Enter value from 0 to 15 
- VOID Return


DisplayClear

DisplayClear
Clear the display. 
- VOID Return


DisplayWrite

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. 
- BYTE Array
Index = line, Content (byte) = column 
- VOID Return


DisplayWriteNumber

DisplayWriteNumber
Show a number ranging from 000 to 999 on the display. Number is printed vertically.  
- UINT Value
Enter a number from 0 to 999. 
- VOID Return


EEReadValue

EEReadValue
Retreives a value from none volitile memory 
- BYTE Address
Address to write to, Range: 0-255 
- BYTE Return


EEStoreValue

EEStoreValue
Saves a value to none volitile memory 
- BYTE Address
Address to write to, Range: 0-255 
- BYTE Value
Value to store, Range: 0-255 
- VOID Return


Initialise

Initialise
Initializes all present hardware and communication. Place this at the very start of your code. 
- VOID Return


LedsWrite

LedsWrite
Set the button-leds. MSB = leftmost led LSB = rightmost led 
- BYTE Value
MSB = leftmost dot, LSB = rightmost dot 
- VOID Return


MP3GetStatus

MP3GetStatus
Returns the status of the MP3 module. 0 = module in sleep 1 = track is playing 2 = track is pauzed 3 = track is stopped 
- BYTE Return


MP3PausePlayResetStop

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


MP3PlayTrack

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". 
- BYTE Directory
0=Root, 01=Folder "01" - 99=Folder "99", 100=Folder "MP3", 101=Advert 
- UINT Track
Track number 1 = "001.mp3" / "0001.mp3" 
- VOID Return


MP3SendCommand

MP3SendCommand
Send commands to MP3 module. Check datasheet for info. 
- BYTE Command
 
- BYTE Para1
 
- BYTE Para2
 
- VOID Return


MP3SetVolume

MP3SetVolume
Sets the volume level for the MP3 module 
- BYTE Volume
Range: 0 (min) - 30 (max) 
- VOID Return


PlayNote

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


PotRead

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) 
- UINT MaxValue
Scale the return value. Enter 0 to skip. 
- UINT Return


PwrLedSet

PwrLedSet
Control the PWR LED. 0 = red + green 1 = red 2 = green 
- BYTE Value
0 = red + green, 1 = red, 2 = green 
- VOID Return


Property reference

Properties
LED Colours
LED On
 
LED Off
 
Display Colours
On Colour
 
Off Colour
 
Background Colour