Documente Academic
Documente Profesional
Documente Cultură
MANTENIMIENTO INTEGRAL
CIMI
GC-F-004 V.01
INSTRUCCIONES EN
BÁSICAS
GC-F--004
GC-F-004 V.01
ARDUINO
https://create.arduino.cc/
https://www.arduino.cc/
GC-F-004 V.01
ESTRUCTURA DE UN SCRIPT
void setup()
{ Espacio para Configuraciones en
la placa.
}
void loop()
{
Espacio para el código.
}
Fuente: https://www.arduino.cc/ GC-F-004 V.01
DIGITAL INPUT/ OUTPUT
1 para Salidas
DDRx=0x0F; 0 Para Entradas
pinMode(x,OUTPUT);
1 = 5V
PORTx=0x0F; 0 = 0V
digitalWrite(x,x);
1 o HIGH=5V
0 o LOW=0V
digitalRead(x);
void setup()
{
pinMode(pin,INPUT);
pinMode(led,OUTPUT);
void loop()
{
val=digitalRead(pin,HIGH);
digitalWrite(led,val);
}
Fuente: https://www.arduino.cc/ GC-F-004 V.01
INSTRUCCIONES DE RETARDO
Unsigned int
delay(x);
delayMicroseconds(x);
Unsigned int
= (assignment operator)
+ (addition)
- (subtraction)
* (multiplication)
/ (division)
% (modulo)
== (equal to)
!= (not equal to)
< (less than)
> (greater than)
<= (less than or equal to)
>= (greater than or equal to)
&& (and)
|| (or)
! (not)
++ (increment)
-- (decrement)
+= (compound addition)
-= (compound subtraction)
*= (compound multiplication)
/= (compound division)
%= (compound modulo)
&= (compound bitwise and)
|= (compound bitwise or)
Fuente: https://www.arduino.cc/ GC-F-004 V.01
EJEMPLOS
}
Fuente: https://www.arduino.cc/ GC-F-004 V.01
ESTRUCTURAS DE CONTROL
if ( )
{
Sentencia A
}
else if ( )
{
Sentencia B
}
else
{
Sentencia C
}
Fuente: https://www.arduino.cc/ GC-F-004 V.01
ESTRUCTURAS DE CONTROL
while( )
{
Sentencia
}
int A=1; int A=0;
while(A) while(A<200)
{ {
Serial.print('A'); A++;
} }
Fuente: https://www.arduino.cc/ GC-F-004 V.01
PUERTO SERIAL
Cantidad de bps
Serial.begin(XXXX);
Valor a visualizar
Serial.print(XXXX);
Fuente: https://www.arduino.cc/ GC-F-004 V.01
EJEMPLOS DE SERIAL MONITOR
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available() > 0)
{
dato = Serial.read();
Serial.print(“Recibiendo: ");
Serial.println(dato, DEC);
}
} Fuente: https://www.arduino.cc/ GC-F-004 V.01
GRACIAS
GC-F--004
GC-F-004 V.01