리뷰 네비게이션

미래 농어업을 선도하는 창의적 인재 육성 대학

본문내용

  • 페이스북 공유하기
  • 트위터 공유하기
  • URL 주소복사
  • 오류신고
  • 페이지 인쇄기능

공지사항

  • 제목 실습코드 2
  • 등록일 2019-07-16
  • 조회수 1543
  • 등록자 채철주
  • 첨부파일
  • #include <SoftwareSerial.h>

    SoftwareSerial mySerial(A0,A1);
    byte cmd[9]={0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79};
    byte response[9];
    String ppmString=" ";

    void setup(){
      Serial.begin(9600);
      mySerial.begin(9600);
      Serial.println("LABEL,TIME,CO2");
    }

    void loop(){
      mySerial.write(cmd,9);
      mySerial.readBytes(response,9);
      byte chck = 0;
      int ppm = (response[2] << 8)|response[3];
      ppmString = String(ppm);

      Serial.print("CO2:");
      Serial.println(ppm);

      Serial.print("DATA,TIME,");
      Serial.print(ppm);
      Serial.println(",");

      delay(1000);
     

※ 본 글에 대한 문의는 "등록자"에게 문의하시기 바랍니다.
※ 광고성 글, 타인에 관한 비방 및 명예 훼손에 관한 글, 주민등록번호나 계좌번호 등 개인정보가 포함된 글( 첨부파일 포함 ) 등 홈페이지의 정상적인 운영을 저해하는 내용은 사전 경고 없이 삭제 될 수 있음을 알려드립니다.