Open nanz17 opened 5 years ago
@nanz17 It is easy to implement. You can refer to the https://github.com/ArduCAM/Arduino/blob/master/ArduCAM/examples/mini/ArduCAM_Mini_Capture2SD/ArduCAM_Mini_Capture2SD.ino
Thanks but that's the example code. It's hard to understand how exactly I can implement it without the host app.
@nanz17 That demo does not use the host V2 app. What's the function of the ArduCAM_Mini_Capture2SD.ino is getting the image and store the image to the SD card periodically.
Okay thanks. I got it :).
@nanz17 have you done this one? How did you connect your ultrasonic pins? Is there are available pins when using the arducam shield?
@KlydeLencioco I have an arduino mega so I have enough free pins. On the arduino uno, there'll be no pins left on the uno board so you have to use the pins on the arducam shield. There are 5v,3.3v and a few pins like 9,10,11 on the shield which can be used for the sensor.
I want the camera module to take a photo when the sensor reads less than 10 cm. I'm currently using example Capture2SD code(Arduino Shield V2) but I want the photo to be taken automatically within the code, not through the host app. Here is the code for the ultrasonic sensor. // --------------------------------------------------------------------------- // Example NewPing library sketch that does a ping about 20 times per second. // ---------------------------------------------------------------------------
include
define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() { Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results. }
void loop() { delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings. Serial.print("Ping: "); Serial.print(sonar.ping_cm()); // Send ping, get distance in cm and print result if (sonar.ping_cm()<10); { //Take Picture and save to SD card}
Serial.println("cm"); }