Jump to content

Component: API (RPI) (API Slave Devices): Difference between revisions

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


Please click here to download the component source project: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_RPI_API_Comp.fcfx FC_Comp_Source_RPI_API_Comp.fcfx]
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_RPI_API_Comp.fcfx FC_Comp_Source_RPI_API_Comp.fcfx]


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


==Detailed description==
==Detailed description==




Line 66: Line 70:


==Examples==
==Examples==




Line 176: Line 184:
|}
|}


==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;" | '''I2CInitialise'''
|-
| colspan="2" | Initialsie the I2C module ready for communications 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Baud
|-
| colspan="2" | 0=100KHz, 1=400KHz, 2=1MHz 
|-
| 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;" | '''SPITransferTrans'''
|-
| colspan="2" | Transfer an array of bytes using the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send and receive 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataOut
|-
| colspan="2" | Outgoing data 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataIn
|-
| colspan="2" | Incoming data 
|-
| 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;" | '''IOGetInputPin'''
|-
| colspan="2" | Sets the selected digital pin to an input and reads the input state. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Pin
|-
| colspan="2" | Range: 0-29 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| 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;" | '''UARTBaud'''
|-
| colspan="2" | Control the communications rate of the UART module 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Rate
|-
| colspan="2" | 0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200 
|-
| 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;"
 
==Macro reference==
 
===ADCSample10===
{| 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;" | '''ADCSample8'''
| width="90%" class="mtx-class-macrohead" | '''ADCSample10'''
|-
|-
| colspan="2" | Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 
| colspan="2" | Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 
|-
|-
|-
|-
Line 287: Line 209:
|-
|-
| colspan="2" | Range: 0-12 
| colspan="2" | Range: 0-12 
|-
| 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''
|}
{| 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;" | '''I2CTransReceive'''
|-
| colspan="2" | Receives an I2C Transaction on the selected I2C channel. Returns the number of bytes received. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | Data variable to receive into 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to receive 
|-
|-
| 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-u16-icon.png]] - UINT
Line 321: Line 215:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===ADCSample8===
{| 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;" | '''UARTInitialise'''
| width="90%" class="mtx-class-macrohead" | '''ADCSample8'''
|-
|-
| colspan="2" | Initialise the UART module ready for communications 
| colspan="2" | Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
| width="90%" | ADCChannel
|-
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
| colspan="2" | Range: 0-12 
|-
| 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;" | '''UARTCheckRX'''
|-
| colspan="2" | Check to see if the UART module has received any data 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 357: Line 234:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CInitialise===
{| 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;" | '''I2CRestart'''
| width="90%" class="mtx-class-macrohead" | '''I2CInitialise'''
|-
|-
| colspan="2" | Put the I2C Module into Restart mode 
| colspan="2" | Initialsie the I2C module ready for communications 
|-
|-
|-
|-
Line 369: Line 247:
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| 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;" | '''PWMDisable'''
|-
| colspan="2" | Disable a PWM output 
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
| width="90%" | Baud
|-
|-
| colspan="2" | Range: 0-1 
| colspan="2" | 0=100KHz, 1=400KHz, 2=1MHz 
|-
| 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;" | '''I2CStart'''
|-
| colspan="2" | Put the I2C Module into Start mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
|-
| 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 411: Line 258:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CReceive===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SPITransfer'''
|-
| colspan="2" | Transfer a byte using the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataOut
|-
| colspan="2" |  
|-
| 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''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| 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;" | '''I2CReceive'''
| width="90%" class="mtx-class-macrohead" | '''I2CReceive'''
|-
|-
| colspan="2" | Receive a byte using the I2C bus 
| colspan="2" | Receive a byte using the I2C bus 
Line 457: Line 282:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CRestart===
{| 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;" | '''I2CStop'''
| width="90%" class="mtx-class-macrohead" | '''I2CRestart'''
|-
|-
| colspan="2" | Put the I2C Module into Stop mode 
| colspan="2" | Put the I2C Module into Restart mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" |  
|-
| 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;" | '''SPIPrescaler'''
|-
| colspan="2" | Modify the speed of the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Prescaler
|-
| colspan="2" | Range: 0-2 
|-
| 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;" | '''PWMSetDuty'''
|-
| colspan="2" | Sets the duty for the PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-5 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Duty
|-
| colspan="2" |  
|-
| 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;" | '''ADCSample10'''
|-
| colspan="2" | Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ADCChannel
|-
| colspan="2" | Range: 0-12 
|-
| 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''
|}
 
 
{| 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;" | '''I2CTransSend'''
|-
| colspan="2" | Sends an I2C Transaction on the selected I2C channel. Returns the number of bytes sent. 
|-
|-
|-
|-
Line 551: Line 295:
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | Data to send 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send out, MS bit 0x8000 signifies no Stop if set 
|-
| 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''
|}
{| 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;" | '''I2CTransInit'''
|-
| colspan="2" | Initialises the I2C Transaction mode with the 7-bit device address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DeviceAddress
|-
| colspan="2" | 7-bit Device Address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Baud
|-
| colspan="2" | 0=100KHz, 1=400KHz, 2=1MHz 
|-
|-
| 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 595: Line 301:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CSend===
{| 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;" | '''IOSetOutputPin'''
| width="90%" class="mtx-class-macrohead" | '''I2CSend'''
|-
| colspan="2" | Sets the selected digital pin to an output and assigns the output state. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Pin
|-
| colspan="2" | Range: 0-29 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | State
|-
| colspan="2" | Range: 0-1 
|-
| 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;" | '''UARTReceive'''
|-
| colspan="2" | Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| 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''
|}
 
 
{| 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;" | '''SPIInitialise'''
|-
| colspan="2" | Initialsie the SPI module ready for communications 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| 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;" | '''I2CSend'''
|-
|-
| colspan="2" | Transmit a byte using the I2C bus 
| colspan="2" | Transmit a byte using the I2C bus 
Line 677: Line 325:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CStart===
{| 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;" | '''UARTSend'''
| width="90%" class="mtx-class-macrohead" | '''I2CStart'''
|-
|-
| colspan="2" | Send a byte via the UART module 
| colspan="2" | Put the I2C Module into Start mode 
|-
|-
|-
|-
Line 688: Line 337:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | Data Byte to send. Range: 0-255 
|-
|-
| 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 700: Line 344:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CStop===
{| 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;" | '''PWMSetPrescaler'''
| width="90%" class="mtx-class-macrohead" | '''I2CStop'''
|-
|-
| colspan="2" | Sets the prescaler for the PWM output 
| colspan="2" | Put the I2C Module into Stop mode 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
| width="90%" | Channel
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Prescaler
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Period
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 728: Line 363:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CTransInit===
{| 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;" | '''PWMEnable'''
| width="90%" class="mtx-class-macrohead" | '''I2CTransInit'''
|-
|-
| colspan="2" | Enable a PWM output 
| colspan="2" | Initialises the I2C Transaction mode with the 7-bit device address 
|-
|-
|-
|-
Line 739: Line 375:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Range: 0-1 
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| 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" | Initialise the comms to the Arduino board ready for commands to be sent. 
|-
|-
| 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''
|}
 
 
 
 
==Property reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connection
|-
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | RPI IP Address
|-
| colspan="2" | IP Address of the Raspbery Pi we want to control 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | RPI Port
|-
| colspan="2" | Port number we want to communicate on. Default 1234 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Network Interface
|-
| colspan="2" | Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network. 
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | IP Address
|-
| colspan="2" | IP Address of the selected network interface. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | API Peripherals
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Digital IO
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Analog Input
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Analog Output
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | PWM Output
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | I2C Bus
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | SPI Bus
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | UART
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | SERVO
|-
| colspan="2" |  
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Console
|-
|-
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| width="90%" | Console Log
|-
| colspan="2" | Create an automatic console log of the commands sent to the Arduino 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Log Mode
|-
| colspan="2" | Controls how the console data is formatted. Fixed statistics gives an easy to read overview of the IO, Analog and PWM functionality Command Log gives a more in depth analysis of the outgoing commands and incoming returns ASCII mode allows serial data to be shown in raw text form, other commands are shown as in the Command Log mode 
|}==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;" | '''I2CInitialise'''
|-
| colspan="2" | Initialsie the I2C module ready for communications 
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
| width="90%" | DeviceAddress
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | 7-bit Device Address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Line 875: Line 392:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CTransReceive===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SPITransferTrans'''
|-
|-
| colspan="2" | Transfer an array of bytes using the SPI bus 
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
|-
| width="90%" class="mtx-class-macrohead" | '''I2CTransReceive'''
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send and receive 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataOut
|-
| colspan="2" | Outgoing data 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataIn
|-
| colspan="2" | Incoming data 
|-
| 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;" | '''IOGetInputPin'''
|-
| colspan="2" | Sets the selected digital pin to an input and reads the input state. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Pin
|-
| colspan="2" | Range: 0-29 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| 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;" | '''UARTBaud'''
|-
| colspan="2" | Control the communications rate of the UART module 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Rate
|-
| colspan="2" | 0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200 
|-
| 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;" | '''ADCSample8'''
|-
| colspan="2" | Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ADCChannel
|-
| colspan="2" | Range: 0-12 
|-
| 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''
|}
 
 
{| 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;" | '''I2CTransReceive'''
|-
|-
| colspan="2" | Receives an I2C Transaction on the selected I2C channel. Returns the number of bytes received. 
| colspan="2" | Receives an I2C Transaction on the selected I2C channel. Returns the number of bytes received. 
Line 995: Line 421:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===I2CTransSend===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UARTInitialise'''
|-
| colspan="2" | Initialise the UART module ready for communications 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| 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;" | '''UARTCheckRX'''
|-
| colspan="2" | Check to see if the UART module has received any data 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| 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''
|}
 
 
{| 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;" | '''I2CRestart'''
|-
| colspan="2" | Put the I2C Module into Restart mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| 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;" | '''PWMDisable'''
|-
| colspan="2" | Disable a PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-1 
|-
| 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;" | '''I2CStart'''
|-
| colspan="2" | Put the I2C Module into Start mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| 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;" | '''SPITransfer'''
|-
| colspan="2" | Transfer a byte using the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataOut
|-
| colspan="2" |  
|-
| 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''
|}
 
 
{| 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;" | '''I2CReceive'''
|-
| colspan="2" | Receive a byte using the I2C bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Last
|-
| colspan="2" | Last byte to receive: Range 0-1 
|-
| 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''
|}
 
 
{| 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;" | '''I2CStop'''
|-
| colspan="2" | Put the I2C Module into Stop mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" |  
|-
| 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;" | '''SPIPrescaler'''
|-
| colspan="2" | Modify the speed of the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Prescaler
|-
| colspan="2" | Range: 0-2 
|-
| 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;" | '''PWMSetDuty'''
|-
| colspan="2" | Sets the duty for the PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-5 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Duty
|-
| colspan="2" |  
|-
| 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;" | '''ADCSample10'''
|-
| colspan="2" | Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ADCChannel
|-
| colspan="2" | Range: 0-12 
|-
| 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''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| 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;" | '''I2CTransSend'''
| width="90%" class="mtx-class-macrohead" | '''I2CTransSend'''
|-
|-
| colspan="2" | Sends an I2C Transaction on the selected I2C channel. Returns the number of bytes sent. 
| colspan="2" | Sends an I2C Transaction on the selected I2C channel. Returns the number of bytes sent. 
Line 1,241: Line 450:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===IOGetInputPin===
{| 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;" | '''I2CTransInit'''
| width="90%" class="mtx-class-macrohead" | '''IOGetInputPin'''
|-
|-
| colspan="2" | Initialises the I2C Transaction mode with the 7-bit device address 
| colspan="2" | Sets the selected digital pin to an input and reads the input state. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
| width="90%" | Pin
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | Range: 0-29 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | DeviceAddress
|-
| colspan="2" | 7-bit Device Address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Baud
|-
| colspan="2" | 0=100KHz, 1=400KHz, 2=1MHz 
|-
| 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;"
===IOSetOutputPin===
{| 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;" | '''IOSetOutputPin'''
| width="90%" class="mtx-class-macrohead" | '''IOSetOutputPin'''
|-
|-
| colspan="2" | Sets the selected digital pin to an output and assigns the output state. 
| colspan="2" | Sets the selected digital pin to an output and assigns the output state. 
Line 1,292: Line 493:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Initialise===
{| 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;" | '''UARTReceive'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
| colspan="2" | Initialise the comms to the Arduino board ready for commands to be sent. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| 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;"
===PWMDisable===
{| 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;" | '''SPIInitialise'''
| width="90%" class="mtx-class-macrohead" | '''PWMDisable'''
|-
|-
| colspan="2" | Initialsie the SPI module ready for communications 
| colspan="2" | Disable a PWM output 
|-
|-
|-
|-
Line 1,321: Line 519:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
| colspan="2" | Range: 0-1 
|-
|-
| 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 1,328: Line 526:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===PWMEnable===
{| 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;" | '''I2CSend'''
| width="90%" class="mtx-class-macrohead" | '''PWMEnable'''
|-
|-
| colspan="2" | Transmit a byte using the I2C bus 
| colspan="2" | Enable a PWM output 
|-
|-
|-
|-
Line 1,339: Line 538:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | Range: 0-1 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | DataOut
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| 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;"
===PWMSetDuty===
{| 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;" | '''UARTSend'''
| width="90%" class="mtx-class-macrohead" | '''PWMSetDuty'''
|-
|-
| colspan="2" | Send a byte via the UART module 
| colspan="2" | Sets the duty for the PWM output 
|-
|-
|-
|-
Line 1,362: Line 557:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
| colspan="2" | Range: 0-5 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
| width="90%" | Duty
|-
|-
| colspan="2" | Data Byte to send. Range: 0-255 
| colspan="2" |  
|-
|-
| 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 1,374: Line 569:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===PWMSetPrescaler===
{| 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;" | '''PWMSetPrescaler'''
| width="90%" class="mtx-class-macrohead" | '''PWMSetPrescaler'''
|-
|-
| colspan="2" | Sets the prescaler for the PWM output 
| colspan="2" | Sets the prescaler for the PWM output 
Line 1,402: Line 598:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SPIInitialise===
{| 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;" | '''PWMEnable'''
| width="90%" class="mtx-class-macrohead" | '''SPIInitialise'''
|-
|-
| colspan="2" | Enable a PWM output 
| colspan="2" | Initialsie the SPI module ready for communications 
|-
|-
|-
|-
Line 1,413: Line 610:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Range: 0-1 
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
|-
| 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 1,420: Line 617:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===SPIPrescaler===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SPIPrescaler'''
|-
| colspan="2" | Modify the speed of the SPI bus 
|-
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
|-
| colspan="2" | Initialise the comms to the Arduino board ready for commands to be sent. 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Prescaler
|-
|-
| colspan="2" | Range: 0-2 
|-
|-
| 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 1,433: Line 641:




 
===SPITransfer===
 
{| class="mtx-class-macrotable wikitable"
==Property reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''SPITransfer'''
|-
|-
|-
| colspan="2" | Transfer a byte using the SPI bus 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connection
|-
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | RPI IP Address
|-
| colspan="2" | IP Address of the Raspbery Pi we want to control 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | RPI Port
|-
| colspan="2" | Port number we want to communicate on. Default 1234 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Network Interface
|-
| colspan="2" | Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network. 
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | IP Address
|-
| colspan="2" | IP Address of the selected network interface. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | API Peripherals
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Digital IO
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Analog Input
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Analog Output
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | PWM Output
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | I2C Bus
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | SPI Bus
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | UART
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | SERVO
|-
| colspan="2" |  
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Console
|-
|-
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| width="90%" | Console Log
|-
| colspan="2" | Create an automatic console log of the commands sent to the Arduino 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Log Mode
|-
| colspan="2" | Controls how the console data is formatted. Fixed statistics gives an easy to read overview of the IO, Analog and PWM functionality Command Log gives a more in depth analysis of the outgoing commands and incoming returns ASCII mode allows serial data to be shown in raw text form, other commands are shown as in the Command Log mode 
|}==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;" | '''I2CInitialise'''
|-
| colspan="2" | Initialsie the I2C module ready for communications 
|-
|-
|-
|-
Line 1,537: Line 653:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Baud
| width="90%" | DataOut
|-
|-
| colspan="2" | 0=100KHz, 1=400KHz, 2=1MHz 
| colspan="2" |  
|-
|-
| 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;"
===SPITransferTrans===
{| 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;" | '''SPITransferTrans'''
| width="90%" class="mtx-class-macrohead" | '''SPITransferTrans'''
|-
|-
| colspan="2" | Transfer an array of bytes using the SPI bus 
| colspan="2" | Transfer an array of bytes using the SPI bus 
Line 1,582: Line 699:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===UARTBaud===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IOGetInputPin'''
|-
| colspan="2" | Sets the selected digital pin to an input and reads the input state. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Pin
|-
| colspan="2" | Range: 0-29 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| 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="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UARTBaud'''
| width="90%" class="mtx-class-macrohead" | '''UARTBaud'''
|-
|-
| colspan="2" | Control the communications rate of the UART module 
| colspan="2" | Control the communications rate of the UART module 
Line 1,623: Line 723:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===UARTCheckRX===
{| 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;" | '''ADCSample8'''
| width="90%" class="mtx-class-macrohead" | '''UARTCheckRX'''
|-
| colspan="2" | Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ADCChannel
|-
| colspan="2" | Range: 0-12 
|-
| 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''
|}
 
 
{| 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;" | '''I2CTransReceive'''
|-
| colspan="2" | Receives an I2C Transaction on the selected I2C channel. Returns the number of bytes received. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | Data variable to receive into 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to receive 
|-
| 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''
|}
 
 
{| 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;" | '''UARTInitialise'''
|-
| colspan="2" | Initialise the UART module ready for communications 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| 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;" | '''UARTCheckRX'''
|-
|-
| colspan="2" | Check to see if the UART module has received any data 
| colspan="2" | Check to see if the UART module has received any data 
Line 1,705: Line 742:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===UARTInitialise===
{| 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;" | '''I2CRestart'''
| width="90%" class="mtx-class-macrohead" | '''UARTInitialise'''
|-
|-
| colspan="2" | Put the I2C Module into Restart mode 
| colspan="2" | Initialise the UART module ready for communications 
|-
|-
|-
|-
Line 1,716: Line 754:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1 
|-
| 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;" | '''PWMDisable'''
|-
| colspan="2" | Disable a PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-1 
|-
| 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;" | '''I2CStart'''
|-
| colspan="2" | Put the I2C Module into Start mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| 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;" | '''SPITransfer'''
|-
| colspan="2" | Transfer a byte using the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataOut
|-
| colspan="2" |  
|-
| 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''
|}
 
 
{| 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;" | '''I2CReceive'''
|-
| colspan="2" | Receive a byte using the I2C bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Last
|-
| colspan="2" | Last byte to receive: Range 0-1 
|-
| 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''
|}
 
 
{| 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;" | '''I2CStop'''
|-
| colspan="2" | Put the I2C Module into Stop mode 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" |  
|-
|-
| 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 1,823: Line 761:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===UARTReceive===
|-
{| class="mtx-class-macrotable wikitable"
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SPIPrescaler'''
|-
| colspan="2" | Modify the speed of the SPI bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Prescaler
|-
|-
| colspan="2" | Range: 0-2 
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
|-
| width="90%" class="mtx-class-macrohead" | '''UARTReceive'''
| 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;" | '''PWMSetDuty'''
|-
| colspan="2" | Sets the duty for the PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-5 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Duty
|-
| colspan="2" |  
|-
| 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;" | '''ADCSample10'''
|-
| colspan="2" | Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ADCChannel
|-
| colspan="2" | Range: 0-12 
|-
| 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''
|}
 
 
{| 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;" | '''I2CTransSend'''
|-
| colspan="2" | Sends an I2C Transaction on the selected I2C channel. Returns the number of bytes sent. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | Data to send 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send out, MS bit 0x8000 signifies no Stop if set 
|-
| 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''
|}
 
 
{| 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;" | '''I2CTransInit'''
|-
| colspan="2" | Initialises the I2C Transaction mode with the 7-bit device address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DeviceAddress
|-
| colspan="2" | 7-bit Device Address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Baud
|-
| colspan="2" | 0=100KHz, 1=400KHz, 2=1MHz 
|-
| 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;" | '''IOSetOutputPin'''
|-
| colspan="2" | Sets the selected digital pin to an output and assigns the output state. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Pin
|-
| colspan="2" | Range: 0-29 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | State
|-
| colspan="2" | Range: 0-1 
|-
| 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;" | '''UARTReceive'''
|-
|-
| colspan="2" | Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
| colspan="2" | Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
Line 1,984: Line 780:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===UARTSend===
{| 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;" | '''SPIInitialise'''
| width="90%" class="mtx-class-macrohead" | '''UARTSend'''
|-
| colspan="2" | Initialsie the SPI module ready for communications 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1 
|-
| 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;" | '''I2CSend'''
|-
| colspan="2" | Transmit a byte using the I2C bus 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataOut
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| 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;" | '''UARTSend'''
|-
|-
| colspan="2" | Send a byte via the UART module 
| colspan="2" | Send a byte via the UART module 
Line 2,046: Line 802:
| 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;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PWMSetPrescaler'''
|-
| colspan="2" | Sets the prescaler for the PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Prescaler
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Period
|-
| colspan="2" |  
|-
| 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;" | '''PWMEnable'''
|-
| colspan="2" | Enable a PWM output 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-1 
|-
| 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" | Initialise the comms to the Arduino board ready for commands to be sent. 
|-
|-
| 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''
|}




==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;" | Connection
| width="90%" class="mtx-class-propfolder" | Connection
|-
|-
|-
|-
Line 2,141: Line 836:
| colspan="2" | IP Address of the selected network interface. 
| colspan="2" | IP Address of the selected network interface. 
|-
|-
| 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;" | API Peripherals
| width="90%" class="mtx-class-propfolder" | API Peripherals
|-
|-
|-
|-
Line 2,185: Line 880:
| colspan="2" |  
| colspan="2" |  
|-
|-
| 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;" | Console
| width="90%" class="mtx-class-propfolder" | Console
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 2.0
Category API Slave Devices


API (RPI) component

Connects to a Raspberry Pi running the API Firmware allowing the board to become a slave to the Flowcode Embedded simulation or Flowcode App Developer. Supports: Digital IO / I2C / SPI / PWM / UART See Flowcode Help Wiki for firmware.

Component Source Code

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

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

Detailed description

The App Developer (RaspberryPi) component allows an Raspberry Pi to be controlled from within the Flowcode simulation runtime.

To allow Flowcode to communicate and control the Raspberry Pi hardware the board must first be pre-programmed with dedicated firmware.

The firmware file and Flowcode source project can be downloaded from here.

RPI App Developer Firmware

More information about the workings of the firmware project can be found on the FiniteStateMachine page.


The IP Address to the Raspberry Pi hardware is selected via the SCADA_RPI component IP Address property.

When building the component into a App Developer project remember to expose the IP Address property to allow the end user to select the correct address for the hardware.


The console window can display data in two modes which is set via a component property.

  • fixed statistics showing IO / ADC inputs / PWM
  • scrolling log showing all commands and returns


Examples

Pin Mapping

Here is a table showing how the App Developer Slave digital pins are mapped on the device.

App Developer Slave Digital Pin 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Device Port Pin G2 G3 G4 G5 G6 G7 G8 G9 G10 G11 G12 G13 G14 G15 G16 G17 G18 G19 G20 G21 G22 G23 G24 G25 G26 G27


Here is a table showing how the App Developer Slave peripheral pins are mapped on the device.

App Developer Slave Peripheral Pin I2C SDA I2C SCL SPI MOSI SPI MISO SPI SCK UART RX UART TX PWM 0 PWM 1
Device Port Pin G2 G3 G10 G9 G11 G15 G14 G12 G13






Macro reference

ADCSample10

ADCSample10
Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 
- BYTE ADCChannel
Range: 0-12 
- UINT Return


ADCSample8

ADCSample8
Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 
- BYTE ADCChannel
Range: 0-12 
- BYTE Return


I2CInitialise

I2CInitialise
Initialsie the I2C module ready for communications 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- BYTE Baud
0=100KHz, 1=400KHz, 2=1MHz 
- VOID Return


I2CReceive

I2CReceive
Receive a byte using the I2C bus 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- BOOL Last
Last byte to receive: Range 0-1 
- BYTE Return


I2CRestart

I2CRestart
Put the I2C Module into Restart mode 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- VOID Return


I2CSend

I2CSend
Transmit a byte using the I2C bus 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- BYTE DataOut
 
- BOOL Return


I2CStart

I2CStart
Put the I2C Module into Start mode 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- VOID Return


I2CStop

I2CStop
Put the I2C Module into Stop mode 
- BYTE Channel
 
- VOID Return


I2CTransInit

I2CTransInit
Initialises the I2C Transaction mode with the 7-bit device address 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- BYTE DeviceAddress
7-bit Device Address 
- BYTE Baud
0=100KHz, 1=400KHz, 2=1MHz 
- VOID Return


I2CTransReceive

I2CTransReceive
Receives an I2C Transaction on the selected I2C channel. Returns the number of bytes received. 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- BYTE Data
Data variable to receive into 
- UINT Count
Number of bytes to receive 
- UINT Return


I2CTransSend

I2CTransSend
Sends an I2C Transaction on the selected I2C channel. Returns the number of bytes sent. 
- BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
- BYTE Data
Data to send 
- UINT Count
Number of bytes to send out, MS bit 0x8000 signifies no Stop if set 
- UINT Return


IOGetInputPin

IOGetInputPin
Sets the selected digital pin to an input and reads the input state. 
- BYTE Pin
Range: 0-29 
- BOOL Return


IOSetOutputPin

IOSetOutputPin
Sets the selected digital pin to an output and assigns the output state. 
- BYTE Pin
Range: 0-29 
- BOOL State
Range: 0-1 
- VOID Return


Initialise

Initialise
Initialise the comms to the Arduino board ready for commands to be sent. 
- VOID Return


PWMDisable

PWMDisable
Disable a PWM output 
- BYTE Channel
Range: 0-1 
- VOID Return


PWMEnable

PWMEnable
Enable a PWM output 
- BYTE Channel
Range: 0-1 
- VOID Return


PWMSetDuty

PWMSetDuty
Sets the duty for the PWM output 
- BYTE Channel
Range: 0-5 
- BYTE Duty
 
- VOID Return


PWMSetPrescaler

PWMSetPrescaler
Sets the prescaler for the PWM output 
- BYTE Channel
 
- BYTE Prescaler
 
- BYTE Period
 
- VOID Return


SPIInitialise

SPIInitialise
Initialsie the SPI module ready for communications 
- BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
- VOID Return


SPIPrescaler

SPIPrescaler
Modify the speed of the SPI bus 
- BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
- BYTE Prescaler
Range: 0-2 
- VOID Return


SPITransfer

SPITransfer
Transfer a byte using the SPI bus 
- BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
- BYTE DataOut
 
- BYTE Return


SPITransferTrans

SPITransferTrans
Transfer an array of bytes using the SPI bus 
- BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
- UINT Count
Number of bytes to send and receive 
- BYTE DataOut
Outgoing data 
- BYTE DataIn
Incoming data 
- VOID Return


UARTBaud

UARTBaud
Control the communications rate of the UART module 
- BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
- BYTE Rate
0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200 
- VOID Return


UARTCheckRX

UARTCheckRX
Check to see if the UART module has received any data 
- BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
- BYTE Return


UARTInitialise

UARTInitialise
Initialise the UART module ready for communications 
- BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
- VOID Return


UARTReceive

UARTReceive
Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
- BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
- BYTE Return


UARTSend

UARTSend
Send a byte via the UART module 
- BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
- BYTE Data
Data Byte to send. Range: 0-255 
- VOID Return


Property reference

Properties
Connection
RPI IP Address
IP Address of the Raspbery Pi we want to control 
RPI Port
Port number we want to communicate on. Default 1234 
Network Interface
Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network. 
IP Address
IP Address of the selected network interface. 
API Peripherals
Digital IO
 
Analog Input
 
Analog Output
 
PWM Output
 
I2C Bus
 
SPI Bus
 
UART
 
SERVO
 
Console
Console Log
Create an automatic console log of the commands sent to the Arduino 
Log Mode
Controls how the console data is formatted. Fixed statistics gives an easy to read overview of the IO, Analog and PWM functionality Command Log gives a more in depth analysis of the outgoing commands and incoming returns ASCII mode allows serial data to be shown in raw text form, other commands are shown as in the Command Log mode