ArduCAM typical problems(Raspberrypi)

Q1:First compile

pi@raspberrypi:cd ArduCAM/example/raspberrypi

$ sudo make
gcc -c default_fonts_spi.c -lwiringPi -Wall
gcc -c utft_spi.c -lwiringPi -Wall
gcc -c arducam.c -lwiringPi -Wall
gcc -c arducam_arch_raspberrypi.c -lwiringPi -Wall
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_init’:
arducam_arch_raspberrypi.c:25:2: warning: implicit declaration of fu
nction ‘wiringPiI2CSetup’ [-Wimplicit-function-declaration] FD = wiringPiI2CSetup(sensor_addr);
^
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_write’:
arducam_arch_raspberrypi.c:55:3: warning: implicit declaration of fu
nction ‘wiringPiI2CWriteReg8’ [-Wimplicit-function-declaration] wiringPiI2CWriteReg8(FD,regID,regDat);
^
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_read’:
arducam_arch_raspberrypi.c:66:3: warning: implicit declaration of fu
nction ‘wiringPiI2CReadReg8’ [-Wimplicit-function-declaration] *regDat = wiringPiI2CReadReg8(FD,regID);
^
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_write16’:
arducam_arch_raspberrypi.c:76:3: warning: implicit declaration of fu
nction ‘wiringPiI2CWriteReg16’ [-Wimplicit-function-declaration] wiringPiI2CWriteReg16(FD,regID,regDat);
^
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_read16’:
arducam_arch_raspberrypi.c:86:3: warning: implicit declaration of fu
nction ‘wiringPiI2CReadReg16’ [-Wimplicit-function-declaration] *regDat = wiringPiI2CReadReg16(FD,regID);
^
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_word_write’:
arducam_arch_raspberrypi.c:101:3: warning: implicit declaration of f
unction ‘i2c_smbus_write_word_data’ [-Wimplicit-function-declaration
] i2c_smbus_write_word_data(FD, reg_H, value);
^
arducam_arch_raspberrypi.c: In function ‘arducam_i2c_word_read’:
arducam_arch_raspberrypi.c:115:3: warning: implicit declaration of f
unction ‘i2c_smbus_write_byte_data’ [-Wimplicit-function-declaration
] r = i2c_smbus_write_byte_data(FD,reg_H,reg_L);
^
arducam_arch_raspberrypi.c:118:3: warning: implicit declaration of f
unction ‘i2c_smbus_read_byte’ [-Wimplicit-function-declaration] *regDat = i2c_smbus_read_byte(FD);
^
gcc -c arducam_ov2640_playback.c -lwiringPi -Wall
gcc -o ov2640_playback default_fonts_spi.o utft_spi.o arducam.o ardu
cam_arch_raspberrypi.o arducam_ov2640_playback.o -lwiringPi -Wall
arducam_arch_raspberrypi.o: In function `arducam_i2c_word_write’:
arducam_arch_raspberrypi.c:(.text+0x384): undefined reference to `i2
c_smbus_write_word_data’
arducam_arch_raspberrypi.o: In function `arducam_i2c_word_read’:
arducam_arch_raspberrypi.c:(.text+0x400): undefined reference to `i2
c_smbus_write_byte_data’
arducam_arch_raspberrypi.c:(.text+0x428): undefined reference to `i2
c_smbus_read_byte’
collect2: error: ld returned 1 exit status
Makefile:6: recipe for target ‘ov2640_playback’ failed
make: *** [ov2640_playback] Error 1

The solutions:

sudo apt-get install wiringpi
sudo apt-get install i2c-tools
sudo apt-get install libi2c-dev
sudo apt-get install python-smbus

1. cd /boot
2. nano config.txt

dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
3. sudo reboot

run the demo:
code : arducam_ov2640_capture.c
sudo ./ov2640_capture -c test.jpg 320×240
code: arducam_ov2640_4cams_capture.c
sudo ./ov2640_4cams_capture -c test1,jpg test2.jpg test3.jpg test4.jpg 320×240
code: arducam_ov5642_capture.c
sudo ./ov5642_capture -c test.jpg 320×240
code: arducam_ov5642_4cams_capture.c
sudo ./ov5642_4cams_capture -c test1,jpg test2.jpg test3.jpg test4.jpg 320×240