Académique Documents
Professionnel Documents
Culture Documents
GPIO
Liaison série
Entrées analogiques
PWM
• Syntax
pinMode(pin, mode)
• Parameters
pin: the number of the pin whose mode you wish to set
mode: INPUT, OUTPUT, or INPUT_PULLUP (R=20K)
• Returns
None
• Syntax
digitalWrite(pin, value)
• Parameters
pin: the pin number
value: HIGH or LOW
• Returns
none
• Syntax
digitalRead(pin)
• Parameters
pin: the number of the digital pin you want to read (int)
• Returns
HIGH or LOW
• Parity error
• Framing error
• Overrun error
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
• Serial.print(val)
Serial.print(val, format)
• Serial.print("hello word");
• i=20;
Serial.print(i,HEX)
• Serial.println()
Met un retour à la ligne
• Available()
Retourne le nombre de caractères reçu dans la fifo de
réception
while (( n=Serial.available())==0)
{
• Read()
Lit un caractère reçu
• Write()
écrit un caractère
char InByte;
InByte = Serial.read();
Serial.write(InByte);
• Syntax
analogRead(pin)
• Parameters
pin: the number of the analog input pin to read
• Returns
int (0 to 1023)
The frequency of the PWM signal on most pins is approximately 490 Hz.