9
163 funciones pinguino 1 1wire.readbit 1wire.readbyte 1wire.reset 1wire.writebit 1wire.writebyte A Abs AnalogRead AnalogWrite C CDC.print CDC.read Cos D DS18B20.configur e DS18B20.crc DS18B20.find DS18B20.getfirst DS18B20.getnext DS18B20.matchrom DS18B20.read DS18B20.readrom Delay DelayMicrosecond s DigitalRead DigitalWrite E EEPROM.read16 EEPROM.read8 EEPROM.write16 EEPROM.write8 G cont. GLCD.SelectFon t GLCD.SetDot GLCD.SetInvert ed GLCD.StringWid th GLCD.WriteComm and GLCD.WriteData GLCD.fastWrite High GLCD.fastWrite Low GetSystemClock I I2C.get I2C.init I2C.readchar I2C.restart I2C.send I2C.sendack I2C.sendnack I2C.start I2C.stop I2C.wait I2C.writechar Int.detach K KB.get L Lcd Lcd.autoscroll Lcd.begin Lcd.blink Lcd.clear Lcd.command O cont. OnCompare2 OnCompareAll OnCounter0 OnCounter1 OnCounter3 OnEeprom OnEvent OnLowVoltage OnOscFailed OnParallel OnSerialRX OnSerialTX OnTimer0 OnTimer1 OnTimer2 OnTimer3 OnUSB P PWM.setdutycycle PWM.setfrequency PWM.setpercentdu tycycle PinMode Play Pow R Rand RandomSeed S SPI.init SPI.printf SPI.read SPI.write Serial.available Serial.begin Serial.flush Serial.getkey

163 funciones pinguino

  • Upload
    lokito

  • View
    546

  • Download
    7

Embed Size (px)

Citation preview

163 funciones pinguino

1

1wire.readbit 1wire.readbyte 1wire.reset 1wire.writebit 1wire.writebyte

A

Abs AnalogRead AnalogWrite

C

CDC.print CDC.read Cos

D

DS18B20.configure DS18B20.crc DS18B20.find DS18B20.getfirst DS18B20.getnext DS18B20.matchrom DS18B20.read DS18B20.readrom Delay DelayMicroseconds DigitalRead DigitalWrite

E

EEPROM.read16 EEPROM.read8 EEPROM.write16 EEPROM.write8

F

Flash.erase Flash.read Flash.write

G

GLCD.CharWidth

G cont.

GLCD.SelectFont GLCD.SetDot GLCD.SetInverted GLCD.StringWidth GLCD.WriteComma

nd GLCD.WriteData GLCD.fastWriteHigh GLCD.fastWriteLow GetSystemClock

I

I2C.get I2C.init I2C.readchar I2C.restart I2C.send I2C.sendack I2C.sendnack I2C.start I2C.stop I2C.wait I2C.writechar Int.detach

K

KB.get

L

Lcd Lcd.autoscroll Lcd.begin Lcd.blink Lcd.clear Lcd.command Lcd.cursor Lcd.display Lcd.home Lcd.init Lcd.leftToRight Lcd.noAutoscroll Lcd.noBlink Lcd.noCursor Lcd.noDisplay Lcd.print Lcd.printFloat Lcd.printNumber

O cont.

OnCompare2 OnCompareAll OnCounter0 OnCounter1 OnCounter3 OnEeprom OnEvent OnLowVoltage OnOscFailed OnParallel OnSerialRX OnSerialTX OnTimer0 OnTimer1 OnTimer2 OnTimer3 OnUSB

P

PWM.setdutycycle PWM.setfrequency PWM.setpercentdutycyc

le PinMode Play Pow

R

Rand RandomSeed

S

SPI.init SPI.printf SPI.read SPI.write Serial.available Serial.begin Serial.flush Serial.getkey Serial.getstring Serial.print Serial.printf Serial.read Servo.attach Servo.detach Servo.read

GLCD.ClearPage GLCD.ClearScreen GLCD.ClearScreenX GLCD.ClearSysTextLi

ne GLCD.CursorTo GLCD.DoReadData GLCD.DrawBitmap GLCD.DrawCircle GLCD.DrawHoriLine GLCD.DrawLine GLCD.DrawRect GLCD.DrawRoundRec

t GLCD.DrawVertLine GLCD.Enable GLCD.FillRect GLCD.GotoXY GLCD.Init GLCD.InvertRect GLCD.PrintFloat GLCD.PrintNumber GLCD.PutChar GLCD.Puts GLCD.ReadData

Lcd.printf Lcd.rightToLeft Lcd.scrollDisplayLeft Lcd.scrollDisplayRig

ht Lcd.send Lcd.setCursor Lcd.write

M

Millis

O

OnADC OnBusCol OnChangePin0 OnChangePin1 OnChangePin2 OnChangePin4to7 OnCompare1

Servo.setMaximumPuls e

Servo.setMinimumPulse Servo.write Sin Sound Sprintf Sqrt

T

Tan Toggle

U

USB.available USB.read USB.send USB.sendint UserInterrupt

El processing solo utiliza 4 funciones:

analogRead - Read a 10 bits analog value on a pin.

Description

pin 13 to 17 can be used as digital I/O or analog input. If one pin between 13 and 17 is used as analog input, all those pins are configured as analog inputs. The read value is a 10 bits analog value ( 0 to 1023 for a 0 to 5Vcc signal ).

Since

Beta 2

Syntax analogRead(pin);pin

pin number to read from (13 to 17 for PIC18F2550)

Output

return a value proportional to the voltage applied on the selected pin ( 0..5V )

ground: return 0

+2.5v: return 511

+5v: return 1023

analogWrite - Configure a Pulse Width Modulation on a pin

Description

pin 11 and 12 can be both or individually used as 10 bits PWM output.

Since

Beta 5

Syntax analogWrite( pin, ratio );pin

Output pin (only 11 or 12 on PIC18F2550)

ratio

this value can be fixed between 0 and 1023. The high level time is proportional to this value.

Output

none

digitalRead - Read level on a pin

Description

Read level on pin, return 0 for voltage considered as LOW and 1 for voltage considered as HIGH. If the pin is not configured as input, you will read the value driven by pinguino (to be confirmed).

In any case, pin must never be driven under ground voltage (relative to pinguino) nor above power supply voltage (relative to pinguino).

Syntax digitalRead(pin);pin

pin to read

Output

level: 0 for low level, 1 for high level

digitalWrite - Write level on a pin

Description

Driver level on a specified pin. When driven LOW, the pin will be set to ground. When driven HIGH, the pin will be set to power supply level, usually +5v.

Syntax digitalWrite(pin,level);pin

pin to change

level

HIGH for high level (usually +5v) or LOW for low level (ground)

Output

None

Y además 1 funcion que hace uso de la función digitalwrite:

Name clear()

Examples None available

Description Clear all pin values.

Syntax clear();

Return None

Usage Application

Y 3 funciones para enviar datos y ver el estado del USB hacia la tarjeta pingüino..

NAme write()

Description Send the given data to Pinguino device with an optional timeout value.

Syntax

write(data);

write(data, timeout);

Parameters data byte[] : data as byte array to be sent

timeout int : amount of time in milliseconds the device will try to send the data

Return None

Usage Application

NAMe: read()

Description: Retrieve the latest message from Pinguino device with an optional timeout value.

Syntax

read(result);

read(result, timeout);

Parameters result byte[] : the data list to be returned

timeout int : amount of time in milliseconds the device will try to give the data

Return None

Name log()

Description Enable/disable status updates.

This method is static and should be called before creating the Pinguino object.

Syntax log(enable);

Parameters enable boolean : enable/disable status updates, disabled by default

Return None

PROGRAMA PINGÜINO:

// test Pinguino with Processing// Jean-Pierre MANDON 2009

#define PIC18F2550int i;uchar todo,mode,pin,value;unsigned char buffer[2];int temp;int endstring;

void clear();

void setup() {for( i=0; i<8; i++ )

pinMode( i, OUTPUT );clear();

}

void loop() {

// select action to perform...if ( USB.available() ) {if (USB.read()=='+'){todo =USB.read();if ( todo=='C' ) clear(); // clear allif ( todo=='W' ) { // switch on/off the specified pinmode = USB.read();pin = USB.read();value = USB.read();if ( mode=='D' ) digitalWrite( pin, value );if ( mode=='A' ) {temp=value+(USB.read()*256);analogWrite( pin, temp );}}

if ( todo=='R' ) {mode = USB.read();pin = USB.read();

if ( mode=='D' ) {buffer[0] = digitalRead( pin );USB.send( buffer, 1 );}

if ( mode=='A' ) {temp = analogRead( pin );buffer[0]=temp;buffer[1]=temp/256;USB.send( buffer, 2 );}}endstring=USB.read(); // read end string byte ( 0 )}}}

void clear() {for( i=0; i<8; i++ ) {digitalWrite( i, LOW );}}