EasyManuals Logo

Arduino MEGA 2560 Application Note

Arduino MEGA 2560
6 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #5 background imageLoading...
Page #5 background image
©16March2017CO2Meter,Inc.AllRightsReserved 5
AppendixA:
ArduniocoderunsonUNO,MEGAORMEGA2560
/* AN-157 Demo of T-66 using Software Serial
Arduino example for t6613 CO2 sensor 0-2000 PPM 19200 BPS
2/2017 by Marv Kausch @ Co2meter.com
*/
#include "SoftwareSerial.h"
SoftwareSerial T66_Serial(12,13); //Sets up a virtual serial port
//Using pin 12 for Rx and pin 13 for Tx
byte readCO2[] = {0xFF, 0XFE,2,2,3}; //T66 read CO2 command: 5 bytes
byte response[] = {0,0,0,0,0}; //create an array to store the response
void setup()
{
// put your setup code here, to run once:
Serial.begin(19200); //Opens the main serial port to communicate with the computer
T66_Serial.begin(19200); //Opens the virtual serial port with a baud of 9600
Serial.println(" Demo of AN-157 Software Serial and T66 sensor");
Serial.print("\n");
}
void loop()
{
sendRequest(readCO2); //Locate the problem of program reset whduring this
function call
unsigned long valCO2 = getValue(response);// Request from sensor 5 bytes of data
Serial.print("Sensor response: ");
for(int i=0;i<5;i++)
{
Serial.print(response[i],HEX);
Serial.print(" ");
}
Serial.print(" Co2 ppm = ");
Serial.println(valCO2);
delay(2000); //T6613 spec indicates signal update every 4 seconds
}
void sendRequest(byte packet[])
{
while(!T66_Serial.available()) //keep sending request until we start to get a
response
{
T66_Serial.write(readCO2,5);// Write to sensor 5 byte command
delay(50);
delay(1000);
}

Other manuals for Arduino MEGA 2560

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino MEGA 2560 and is the answer not in the manual?

Arduino MEGA 2560 Specifications

General IconGeneral
MicrocontrollerATmega2560
Operating Voltage5V
Input Voltage (recommended)7-12V
Input Voltage (limit)6-20V
Digital I/O Pins54
PWM Channels15
Analog Input Pins16
DC Current per I/O Pin20 mA
DC Current for 3.3V Pin50 mA
Flash Memory256 KB of which 8 KB used by bootloader
SRAM8 KB
EEPROM4 KB
Clock Speed16 MHz
LED_BUILTIN13
Length101.52 mm
Width53.3 mm
Weight37 g

Related product manuals