Difference between revisions of "Component: GameCode (Misc Circuit)"

From Flowcode Help
Jump to navigationJump to search
Line 101: Line 101:
  
 
[[File:GSMInject.jpg]]
 
[[File:GSMInject.jpg]]
 +
 +
  
  
Line 112: Line 114:
 
==Macro reference==
 
==Macro reference==
  
 +
===PlayNote===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 135: Line 138:
  
  
 +
===DisplayWrite===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 153: Line 157:
  
  
 +
===PotRead===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 171: Line 176:
  
  
 +
===PwrLedSet===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 189: Line 195:
  
  
 +
===EEStoreValue===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 212: Line 219:
  
  
 +
===MP3PlayTrack===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 235: Line 243:
  
  
 +
===MP3GetStatus===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 248: Line 257:
  
  
 +
===MP3PausePlayResetStop===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 266: Line 276:
  
  
 +
===MP3SendCommand===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 294: Line 305:
  
  
 +
===EEReadValue===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 312: Line 324:
  
  
 +
===DisplayWriteNumber===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 330: Line 343:
  
  
 +
===DisplayClear===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 343: Line 357:
  
  
 +
===BatteryRead===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 356: Line 371:
  
  
 +
===LedsWrite===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 374: Line 390:
  
  
 +
===MP3SetVolume===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 392: Line 409:
  
  
 +
===DisplayBrightness===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 410: Line 428:
  
  
 +
===Initialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-

Revision as of 11:50, 3 February 2023

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

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






Macro reference

PlayNote

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


DisplayWrite

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


PotRead

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


PwrLedSet

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


EEStoreValue

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


MP3PlayTrack

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


MP3GetStatus

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


MP3PausePlayResetStop

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


MP3SendCommand

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


EEReadValue

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


DisplayWriteNumber

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


DisplayClear

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


BatteryRead

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


LedsWrite

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


MP3SetVolume

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


DisplayBrightness

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


Initialise

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



Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png LED Colours
Fc9-type-1-icon.png LED On
 
Fc9-type-1-icon.png LED Off
 
Fc9-conn-icon.png Display Colours
Fc9-type-1-icon.png On Colour
 
Fc9-type-1-icon.png Off Colour
 
Fc9-type-1-icon.png Background Colour