Pneumatiek#
Invoering#
De VEX V5 Brain kan het CTE Pneumatic-systeem aansturen met behulp van de pneumatische klasse pneumatic Deze klasse stelt de Brain in staat de pneumatische pomp te besturen en pneumatische cilinders uit te schuiven of in te trekken.
Opmerking: CTE Pneumatic-commando’s vereisen de CTE-module. Importeer deze met behulp van using namespace cte;.
Klasseconstructors#
pneumatic(
int32_t index );
Klasse-destructor#
Destroys the pneumatic object and releases associated resources.
~pneumatic();
Parameters#
Parameter |
Type |
Beschrijving |
|---|---|---|
|
|
De slimme poort waarop de CTE pneumatische magneetklep is aangesloten (bijv. PORT1). |
Notities#
De commando’s van CTE Pneumatic werken alleen met de onderdelen van CTE Pneumatic.
Je moet de CTE-module handmatig importeren:
using namespace cte;.Het systeem kan tot 4 cilinders afzonderlijk of allemaal tegelijk aansturen.
Voorbeeld#
using namespace cte;
// Create a CTE Pneumatic Solenoid in Port 1
pneumatic ctePneumatic1 = pneumatic(PORT1);
// Turn on the pump and extend cylinder 1
ctePneumatic1.pump_on();
ctePneumatic1.extend(cylinder1);
Lidfuncties#
De pneumatische klasse pneumatic omvat de volgende lidfuncties:
extend— Een cilinder verlengen.retract— Trek een cilinder terug.pump_on— Schakelt de pneumatische pomp in.pump_off— Schakelt de pneumatische pomp uit.pump— Schakelt de pneumatische pomp in of uit.installed— Geeft aan of de solenoïde al dan niet met de hersenen is verbonden.
Voordat er lidfuncties van pneumatic kunnen worden aangeroepen, moet er een instantie van pneumatic worden aangemaakt, zoals hieronder weergegeven:
using namespace cte;
/* This constructor is required to use a
CTE Pneumatic Solenoid. Replace the values
as needed. */
// Create the pneumatic instance on Port 1
pneumatic ctePneumatics1 = pneumatic(PORT1);
extend#
Verlengt een pneumatische cilinder.
Available Functionsvoid extend(
cylinderType id );
Parameter |
Type |
Beschrijving |
|---|---|---|
|
|
De cilinder die verlengd moet worden:
|
Deze functie retourneert geen waarde.
Examples// Extend cylinder 1
ctePneumatic1.extend(cylinder1);
// Extend all cylinders
ctePneumatic1.extend(cylinderAll);
retract#
Trekt een pneumatische cilinder terug.
Available Functionsvoid retract(
cylinderType id );
Parameter |
Type |
Beschrijving |
|---|---|---|
|
|
De cilinder die moet worden ingetrokken:
|
Deze functie retourneert geen waarde.
Examples// Retract cylinder 2
ctePneumatic1.retract(cylinder2);
// Retract all cylinders
ctePneumatic1.retract(cylinderAll);
pump_on#
Schakelt de pneumatische pomp in.
Available Functionsvoid pump_on();
Deze functie heeft geen parameters.
Return ValuesDeze functie retourneert geen waarde.
Examples// Turn the pneumatic pump on
ctePneumatic1.pump_on();
pump_off#
Schakelt de pneumatische pomp uit.
Available Functionsvoid pump_off();
Deze functie heeft geen parameters.
Return ValuesDeze functie retourneert geen waarde.
Examples// Turn the pneumatic pump off
ctePneumatic1.pump_off();
pump#
Hiermee wordt de pneumatische pomp in- of uitgeschakeld.
Available Functionsvoid pump(
bool state );
Parameter |
Type |
Beschrijving |
|---|---|---|
|
|
De in te stellen status: |
Deze functie retourneert geen waarde.
Examples// Turn the pump on
ctePneumatic1.pump(true);
// Turn the pump off
ctePneumatic1.pump(false);
installed#
Geeft aan of de CTE-pneumatische solenoïde is aangesloten op de hersenen.
Available Functionsbool installed();
Deze functie heeft geen parameters.
Return ValuesGeeft een Booleaanse waarde terug die aangeeft of de solenoïde al dan niet met de Brain is verbonden.
trueals de solenoïde is verbonden met de hersenen.falseals de solenoïde niet is aangesloten op de hersenen.
// Check if the pneumatic solenoid is connected
if (ctePneumatic1.installed()) {
// Pneumatic system is ready
ctePneumatic1.pump_on();
}