hi there...I new to arduino and C, programming experience in PowerBASIC and assembler,
having trouble using channelabels, using automation direct P1AM processer, the error message is
"cannot convert 'channelLabel' to 'uint32_t (aka long unsigned int) for argment '1' to 'int digiitalRead(uint32_t)'
#include <P1AM.h>
void setup() { // the setup routine runs once:
Serial.begin(115200); //initialize serial communication at 115200 bits per second
while(!P1.init())
{
; //wait for Modules to sign on
}
}
/*
- I/O assignments
- labels for outputs SLOT-1 P1-15TD2 MODULE 16 points of INPUT
*/
channelLabel ZaxisDIRECTION = {1,1}; // SLOT-1 - CH-1: z-axis dirEction control 1=UP / 0= DOWN
channelLabel SINGLATE = {1,2}; // SLOT-1 - CH-2: singlator air cylinder 1=singlate / 0= pick
channelLabel VACUUM = {1,3}; // SLOT-1 - CH-3: vacuum generator solenoid 1=vacuum on / 0= vacuum off
channelLabel XaxisAIRcylinder = {1,4};// SLOT-1 - CH-4: x-axis air cylinder 1=load / 0= home
channelLabel GREENlight = {1,5}; // SLOT-1 - CH-5: green light control 1=on / 0= off
channelLabel REDlight = {1,5}; // SLOT-1 - CH-6: red light control 1=on / 0= off
/* *********************************************************************************************
- labels for inputs SLOT-2 P2-16ND3 MODULE 16 points of OUTPUT
*/
channelLabel ZaxisHOME = {2,1}; // SLOT-2 - CH-1: z-axis home position sensor 1=home / 0= not-home
channelLabel ZaxisSIGNdetect = {2,2}; // SLOT-2 - CH-2: z-axis sign detection sensor 1=sign present / 0= not-sign present
channelLabel VACUUMsignDETECT = {2,3}; // SLOT-2 - CH-3: vacuum cup sign detection sensor 1=sign present / 0= not-sign present
channelLabel ESTOPswitch = {2,4}; // SLOT-2 - CH-4: e-stop switch 1=not-e-stop / 0= e-stop
channelLabel RUNstopSWITCH = {2,5}; // SLOT-2 - CH-5: run / stop switch 1=run / 0= stop
channelLabel CYCLEstartSWITCH = {2,6}; // SLOT-2 - CH-6: cycle start switch 1=not start / 0= start
channelLabel XaxisHOME = {2,7}; // SLOT-2 - CH-7: x-axis home position sensor 1=home / 0= not-home
channelLabel XaxisLOAD = {2,8}; // SLOT-2 - CH-8: x-axis load position sensor 1=load / 0= not-load
/* *********************************************************************************************
- labels for inputs SLOT-3 P1-04PWM MODULE 4 channels fo PWM OUTPUT
*/
float dutyCycle = 50.15; //sets dutyCycle variable to 50.15
int frequency = 100; //sets frequency variable to 10000Hz
/* *********************************************************************************************
*
*/
void begin
void loop() { // the loop routine runs over and over again forever:
P1.writeDiscrete(HIGH,GREENlight); //green light control= ON
delay(500); //wait .5 second
P1.writeDiscrete(LOW,GREENlight); //green light control= OFF
delay(500); //wait .5 second
if (digitalRead(CYCLEstartSWITCH) == LOW)// SLOT-2 - CH-6: cycle start switch 1=not start / 0= start
{
Call a RUNmachine
}
/else if (digitalRead int(ESTOPswitch) == LOW)// SLOT-2 - CH-4: e-stop switch 1=not-e-stop / 0= e-stop
{
Call a ESTOPmachine
}
}
void RUNmachine();
P1.writeDiscrete(HIGH,GREENlight); //green light control= ON
// machine running area
void ESTOPmachine();
void loopESTOP() { // the loop routine runs over and over again forever:
P1.writeDiscrete(HIGH,ESTOPswitch); //red light control= ON
delay(500); //wait .5 second
P1.writeDiscrete(LOW,ESTOPswitch); //red light control= OFF
delay(500); //wait .5 second
if (digitalRead(ESTOPswitch) == HIGH)// SLOT-2 - CH-4: e-stop switch 1=not-e-stop / 0= e-stop
{
Call a RESETmachineFROMestop
}
void RESETmachineFROMestop();
// reinitialize machine after e-stop condition
// re-home z-anis
// reset all air cylinders to home postions
P1.writeDiscrete(LOW,ESTOPswitch); //red light control= OFF
hi there...I new to arduino and C, programming experience in PowerBASIC and assembler,
having trouble using channelabels, using automation direct P1AM, the error message is
"cannot convert 'channelLabel' to 'uint32_t (aka long unsigned int) for argment '1' to 'int digiitalRead(uint32_t)'
#include <P1AM.h>
void setup() { // the setup routine runs once:
Serial.begin(115200); //initialize serial communication at 115200 bits per second
while(!P1.init())
{
; //wait for Modules to sign on
}
}
/*
* I/O assignments
* *********************************************************************************************
* labels for outputs SLOT-1 P1-15TD2 MODULE 16 points of INPUT
*/
channelLabel ZaxisDIRECTION = {1,1}; // SLOT-1 - CH-1: z-axis dirEction control 1=UP / 0= DOWN
channelLabel SINGLATE = {1,2}; // SLOT-1 - CH-2: singlator air cylinder 1=singlate / 0= pick
channelLabel VACUUM = {1,3}; // SLOT-1 - CH-3: vacuum generator solenoid 1=vacuum on / 0= vacuum off
channelLabel XaxisAIRcylinder = {1,4};// SLOT-1 - CH-4: x-axis air cylinder 1=load / 0= home
channelLabel GREENlight = {1,5}; // SLOT-1 - CH-5: green light control 1=on / 0= off
channelLabel REDlight = {1,5}; // SLOT-1 - CH-6: red light control 1=on / 0= off
/* *********************************************************************************************
* labels for inputs SLOT-2 P2-16ND3 MODULE 16 points of OUTPUT
*/
channelLabel ZaxisHOME = {2,1}; // SLOT-2 - CH-1: z-axis home position sensor 1=home / 0= not-home
channelLabel ZaxisSIGNdetect = {2,2}; // SLOT-2 - CH-2: z-axis sign detection sensor 1=sign present / 0= not-sign present
channelLabel VACUUMsignDETECT = {2,3}; // SLOT-2 - CH-3: vacuum cup sign detection sensor 1=sign present / 0= not-sign present
channelLabel ESTOPswitch = {2,4}; // SLOT-2 - CH-4: e-stop switch 1=not-e-stop / 0= e-stop
channelLabel RUNstopSWITCH = {2,5}; // SLOT-2 - CH-5: run / stop switch 1=run / 0= stop
channelLabel CYCLEstartSWITCH = {2,6}; // SLOT-2 - CH-6: cycle start switch 1=not start / 0= start
channelLabel XaxisHOME = {2,7}; // SLOT-2 - CH-7: x-axis home position sensor 1=home / 0= not-home
channelLabel XaxisLOAD = {2,8}; // SLOT-2 - CH-8: x-axis load position sensor 1=load / 0= not-load
/* *********************************************************************************************
* labels for inputs SLOT-3 P1-04PWM MODULE 4 channels fo PWM OUTPUT
*/
float dutyCycle = 50.15; //sets dutyCycle variable to 50.15
int frequency = 100; //sets frequency variable to 10000Hz
/* *********************************************************************************************
*
*/
void begin
void loop() { // the loop routine runs over and over again forever:
P1.writeDiscrete(HIGH,GREENlight); //green light control= ON
delay(500); //wait .5 second
P1.writeDiscrete(LOW,GREENlight); //green light control= OFF
delay(500); //wait .5 second
if (digitalRead(CYCLEstartSWITCH) == LOW)// SLOT-2 - CH-6: cycle start switch 1=not start / 0= start
{
Call a RUNmachine
}
/else if (digitalRead int(ESTOPswitch) == LOW)// SLOT-2 - CH-4: e-stop switch 1=not-e-stop / 0= e-stop
{
Call a ESTOPmachine
}
}
void RUNmachine();
P1.writeDiscrete(HIGH,GREENlight); //green light control= ON
// machine running area
void ESTOPmachine();
void loopESTOP() { // the loop routine runs over and over again forever:
P1.writeDiscrete(HIGH,ESTOPswitch); //red light control= ON
delay(500); //wait .5 second
P1.writeDiscrete(LOW,ESTOPswitch); //red light control= OFF
delay(500); //wait .5 second
if (digitalRead(ESTOPswitch) == HIGH)// SLOT-2 - CH-4: e-stop switch 1=not-e-stop / 0= e-stop
{
Call a RESETmachineFROMestop
}
void RESETmachineFROMestop();
// reinitialize machine after e-stop condition
// re-home z-anis
// reset all air cylinders to home postions
P1.writeDiscrete(LOW,ESTOPswitch); //red light control= OFF