<< to CrossControl homepage

Support & Service Center

Access state of CCpilot VC hardware buttons from CoDeSys

Printer-friendly versionPrinter-friendly versionPDF versionPDF version
This application shows how the state of the hardware buttons on the CCpilot VC can be read and used in the GUI. When a button is pressed, the square next to the button changes color to green. The project uses the cc-aux interface to handle the states of the buttons. The state is then available from the GUI.

Extract from included PLC_PRG
// Read the state of the hardware buttons from cc-aux api with Button_GetValues.
IF firstTime THEN
	result := About_GetNrOfButtons(numbuttons=>numberOfButtons );
END_IF
 
IF result = ERR_SUCCESS AND numberOfButtons > 0 THEN
	result := Button_GetValues(values=>frontButtonValues );
	IF result = ERR_SUCCESS THEN
		frontButtonValues.0; // Button 1
		frontButtonValues.1; // Button 2
		frontButtonValues.2; // Button 3
		frontButtonValues.3; // Button 4
		frontButtonValues.4; // Button 5
		frontButtonValues.5; // Button 6
		frontButtonValues.6; // Button 7
		frontButtonValues.7; // Button 8
	END_IF
END_IF
Environment and Versions: 

CCAux 2.7.3 or newer

CoDeSys 3.5.4.2 or newer

 

AttachmentSize
Binary Data ReadButtonValues.projectarchive12.23 MB
whatever