Artifact 3937d789e13d1bde350ee1387b0130c7569c3348:
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/MULTI/arduino_SimpleSM_0.2/SimpleMessageSystem_example_1/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/OUTPUT/Camara_Opto/Camara_Opto/Camara_Opto_sms/SimpleMessageSystem_example_1/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/OUTPUT/Camara_Opto/Camara_Opto/Camara_Opto_sms/SimpleMessageSystem_example_1/applet/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/OUTPUT/Motor DC/Motor_DC_sms/SimpleMessageSystem_example_1/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/OUTPUT/Motor DC/Motor_DC_sms/SimpleMessageSystem_example_1/applet/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/OUTPUT/Pwm output/PWM_leds_sms/SimpleMessageSystem_example_1/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/Wireless/arduino_SimpleSM_0.2/SimpleMessageSystem_example_1/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
- File Pensum/Semestre2/ArteInteractividad/Manizales_011/ARDUINO/Arduino Code/Wireless/arduino_SimpleSM_0.2/SimpleMessageSystem_example_1/applet/SimpleMessageSystem.cpp — part of check-in [943a54e959] at 2013-01-24 16:47:47 on branch trunk — Organizando las memorias del pensum de lo visto/hecho hasta el momento, por semestres (user: offray size: 2329)
/* See SimpleMessageSystem.h for more information. */ // the size of the incomming message buffer (Arduino 0004 has a serial in buffer of 64 bytes) #define MESSAGE_BUFFER_SIZE 64 #define MESSAGE_BUFFER_LAST_ELEMENT 63 //ADDED FOR COMPATIBILITY WITH WIRING extern "C" { #include <stdlib.h> } //ADDED END #include "WProgram.h" #include "HardwareSerial.h" //ADDED FOR COMPATIBILITY WITH WIRING #include "SimpleMessageSystem.h" // local variables char messageState = 0; char messageBufferSerialByte; int messageBufferIndex = 0; char messageBuffer[MESSAGE_BUFFER_SIZE]; char *messageBufferLast; char *messageBufferWord; char messageSendState = 0; // local function prototype char messageNext(); void messageSpacer(); // INPUT MESSAGES CODE int messageGetInt() { if (messageNext()) return atoi(messageBufferWord); return 0; } char messageNext() { char * temppointer= NULL; switch (messageState) { case 0: return 0; case 1: temppointer = messageBuffer; messageState = 2; default: messageBufferWord = strtok_r(temppointer," ",&messageBufferLast); if (messageBufferWord != NULL) return 1; } return 0; } char messageGetChar() { if (messageNext()) return messageBufferWord[0]; return 0; } int messageBuild() { int size = 0; messageState = 0; while (Serial.available() > 0) { messageBufferSerialByte = Serial.read(); switch (messageBufferSerialByte) { case 10: break; case 13: size = messageBufferIndex; messageBuffer[messageBufferIndex]=0; messageBufferIndex=0; messageState = 1; break; default: messageBuffer[messageBufferIndex]=messageBufferSerialByte; messageBufferIndex = messageBufferIndex + 1; } if (messageBufferIndex >= MESSAGE_BUFFER_LAST_ELEMENT) messageBufferIndex=0; } return size; } // OUTPUT MESSAGES CODE void messageSendChar(char value) { messageSpacer(); Serial.print(value); } void messageSendInt(int value) { messageSpacer(); Serial.print(value); } void messageEnd() { messageSendState = 0; Serial.println(); } void messageSpacer() { if (messageSendState==1) Serial.print((char) 32); messageSendState = 1; }