Recent Posts

Pages: [1] 2 3 ... 10
1
Storage / Re: w.program.h not found in l...
Last post by AHETEKU - Today at 05:11 am
thanks a lot guys am most grateful
but there is another problem after correcting wprogram.h

the problem now is sdFat does not name a type and below is the erroe and my code please help me out


Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"

In file included from C:\Users\STEADF~1\AppData\Local\Temp\arduino_modified_sketch_345838\sketch_jun23b.ino:20:0:

C:\Program Files (x86)\Arduino\libraries\SdFat/SdFat.h:283:8: error: conflicting return type specified for 'virtual void SdFile::write(uint8_t)'

   void write(uint8_t b);

        ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:232,

                 from sketch\sketch_jun23b.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:51:20: error:   overriding 'virtual size_t Print::write(uint8_t)'

     virtual size_t write(uint8_t) = 0;

                    ^

sketch_jun23b:23: error: 'SdFat' does not name a type

 SdFat sd;

 ^

C:\Users\STEADF~1\AppData\Local\Temp\arduino_modified_sketch_345838\sketch_jun23b.ino: In function 'void setup()':

sketch_jun23b:45: error: 'sd' was not declared in this scope

   if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();

        ^

C:\Users\STEADF~1\AppData\Local\Temp\arduino_modified_sketch_345838\sketch_jun23b.ino: In function 'void loop()':

sketch_jun23b:62: error: 'O_AT_END' was not declared in this scope

     if (!myFile.open(photoTitle, O_RDWR | O_CREAT | O_AT_END)) {

                                                     ^

sketch_jun23b:63: error: 'sd' was not declared in this scope

       sd.errorHalt("opening photoTitle.txt for write failed");

       ^

exit status 1
'SdFat' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




/***************************
PIR Motion Detection - Camera Capture

by Jennifer Case
5/21/2013

Parts:
-PIR Sensor
-SD Card Breakout Board
-TTL Camera

Pin 2,3 - Camera
Pin 8 - PIR Sensor
Pin 10 - CS/D3
Pin 11 - CMD
Pin 12 - D0
Pin 13 - CLK
****************************/
#include <SoftwareSerial.h>
#include <SdFat.h>

//SD Card
SdFat sd;
SdFile myFile;
int picCnt = 0;

//Camera
byte incomingbyte;
SoftwareSerial cameraSerial = SoftwareSerial(2, 3);   //Configure pin 2 and 3 as soft serial port
int a=0x0000,j=0,k=0,count=0;   //Read Starting address       
uint8_t MH,ML;
boolean EndFlag=0;

//Declare pins
const int chipSelect = 10;
int pirPin = 8;

void setup() {
  Serial.begin(19200); //start serial
  cameraSerial.begin(38400); //start serial with camera
 
  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
 
  SendResetCmd(); //allows camera to take pictures
  delay(3000); //delay necessary for camera reset
}

void loop() {
  int val = digitalRead(pirPin); //read from PIR sensor
 
  //when val is HIGH, there is motion -> take pictures
  if (val == HIGH) {
    //create title for images
    char photoTitle[25] = {};
    sprintf(photoTitle, "pic%d.txt", picCnt);
    //Serial.println(photoTitle);
   
    //make sure file can be created, otherwise print error
    if (!myFile.open(photoTitle, O_RDWR | O_CREAT | O_AT_END)) {
      sd.errorHalt("opening photoTitle.txt for write failed");
    }
   
    //Serial.print("Writing to file...");
   
    SendTakePhotoCmd(); //take photo
    delay(200); //delay to make sure there is no drop in the data
    //Serial.println("Start pic");
 
    while(cameraSerial.available()>0) {
      incomingbyte=cameraSerial.read(); //clear unneccessary serial from camera
    }
    byte b[32];
   
    while(!EndFlag) { 
      j=0;
      k=0;
      count=0;
      SendReadDataCmd(); //command to get picture from camera
             
      delay(75); //delay necessary for data not to be lost
      while(cameraSerial.available()>0) {
        incomingbyte=cameraSerial.read(); //read serial from camera
        k++;
        if((k>5)&&(j<32)&&(!EndFlag)) {
          b[j]=incomingbyte;
          if((b[j-1]==0xFF)&&(b[j]==0xD9))
          EndFlag=1; //when end of picture appears, stop reading data                         
          j++;
          count++;
        }
      }
             
      for(j=0;j<count;j++) { //store picture into file
        if(b[j]<0x10)
          myFile.print("0");
        myFile.print(b[j], HEX);
      }
      myFile.println();
    }
   
    StopTakePhotoCmd(); //stop this picture so another one can be taken
    EndFlag = 0; // reset flag to allow another picture to be read
    //Serial.println("End of pic");
   
    myFile.close(); //close file
    //Serial.println("done.");
    //Serial.println();
   
    picCnt++; //increment value for next picture
  }
}

//Send Reset command
void SendResetCmd() {
  cameraSerial.write((byte)0x56);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x26);
  cameraSerial.write((byte)0x00);   
}

//Send take picture command
void SendTakePhotoCmd() {
  cameraSerial.write((byte)0x56);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x36);
  cameraSerial.write((byte)0x01);
  cameraSerial.write((byte)0x00);
   
  a = 0x0000; //reset so that another picture can taken
}

void FrameSize() {
  cameraSerial.write((byte)0x56);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x34);
  cameraSerial.write((byte)0x01);
  cameraSerial.write((byte)0x00); 
}

//Read data
void SendReadDataCmd() {
  MH=a/0x100;
  ML=a%0x100;
     
  cameraSerial.write((byte)0x56);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x32);
  cameraSerial.write((byte)0x0c);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x0a);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)MH);
  cameraSerial.write((byte)ML);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x20);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x0a);

  a+=0x20;
}

void StopTakePhotoCmd() {
  cameraSerial.write((byte)0x56);
  cameraSerial.write((byte)0x00);
  cameraSerial.write((byte)0x36);
  cameraSerial.write((byte)0x01);
  cameraSerial.write((byte)0x03);       
}

2
This is happening to me too, but with all of my nanos.
3
Best read the how to use stickies and post your code in the proper manner, using </> tags
4
Displays / RELOJ DIGITAL
Last post by Kenneth_C - Today at 04:55 am
Tengo que hacer un proyecto, es un reloj digital, los displays son de 7 segmentos, positivo comun, estos son controlados con el chip 74ls47, y el arduino se encarga de controlar las patillas ABCD, El reloj ya esta en funcionamiento, pero el profesoy me pidio que le pusiera un alarma, pero esta que sea ingresada por el monitor serial, entonces, la idea es asi, un reloj digital que cuando yo escriba en el monitor serial 12( se configure como la hora 12 a la que suene) luego 07( y que sea el minuto 07 al que suene) Esto es un ejemplo, el profesor me dio una pista me dijo que tenia que buscar la manera de que el monitor serial leyera dos bytes, entonces no se como hacerlo, agradeceria la ayuda
Dejo el codigo adjuntado
5
Sensors / Re: Reliable capacitive proxim...
Last post by wvmarle - Today at 04:45 am
Maybe I resort to buying as many of those discontinued MPR121s as I can find
I'd only do that as a last resort, or to support a legacy project. Never for any new design. There's usually a good reason for chips to be discontinued: mostly because there's a successor that does the job better in many different ways making the old one obsolete.

Indeed looking at the data sheet the interface of these chips looks quite simple. Maybe a few commands to initialise them in your setup(), after that it looks like it's a very simple requestFrom() call to read the current state of the sensors.

7
Project Guidance / Re: Multiple I2C Buses
Last post by wvmarle - Today at 04:40 am
Quote
You still haven't mentioned the distance these sensors need to be from the Arduino.
... nor which exact sensor we're actual talking about, nor how many of them are involved.
8
Programming Questions / Re: IF and TONE do not mix!
Last post by mattlogue - Today at 04:39 am
Try ToneLibrary (available in the Library Manager).
Thanks this looks awesome. It doesn't rely on the built in tone function.
9
Every time I try to upload any sketch to my brand new Arduino Uno, this same error occurs
(avrdude: ser_open() : can't set com-state for "\\.\COM5"). I've attempted to use many of the example sketches and have successfully verified that the sketches work but when it comes to uploading the sketches that same error occurs. I am completely lost please help.

Thanks, Sterling
10
Ahh ha! I wired it wrong.

It works at 8v, 5v & 3.3v with a very small load. I will test higher loads and other voltages.
Pages: [1] 2 3 ... 10