Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error: 'HardWire' does not name a type #1

Closed
kozuch opened this issue Aug 14, 2018 · 6 comments
Closed

Compiler error: 'HardWire' does not name a type #1

kozuch opened this issue Aug 14, 2018 · 6 comments

Comments

@kozuch
Copy link

kozuch commented Aug 14, 2018

Hi there, the project will not compile for me. I get following error on STM32F103C8T6 (blue pill):

Arduino: 1.8.5 (Windows 7), Vývojová deska: "Generic STM32F103C series, STM32F103C8 (20k RAM. 64k Flash), Serial, 72Mhz (Normal), Smallest (default)"

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp:9:1: error: 'HardWire' does not name a type

 HardWire mWire(2);

 ^

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp: In member function 'void CameraOV7670Registers::init()':

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp:14:3: error: 'mWire' was not declared in this scope

   mWire.begin();

   ^

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp: In member function 'bool CameraOV7670Registers::setRegister(uint8_t, uint8_t)':

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp:47:3: error: 'mWire' was not declared in this scope

   mWire.beginTransmission(i2cAddress);

   ^

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp: In member function 'uint8_t CameraOV7670Registers::readRegister(uint8_t)':

C:\Users\Jack\Documents\Arduino\libraries\LiveOV7670_STM32\CameraOV7670Registers.cpp:66:3: error: 'mWire' was not declared in this scope

   mWire.beginTransmission(i2cAddress);

   ^

Byly nalezené násobné knihovny "Wire.h"
 Used: C:\Users\Jack\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2018.7.2\libraries\Wire
 Unused: C:\Users\Jack\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2018.7.2\libraries\WireSlave
exit status 1
Nastala chyba při kompilaci u desky Generic STM32F103C series.

Can you help me please? I tried downloading and including some a HardWire library but then had an unmet dependency which I did not pursue yet.

Tried to use this: http://downloads.arduino.cc/libraries/github.com/thexeno/HardWire-1.0.2.zip

@kozuch
Copy link
Author

kozuch commented Aug 15, 2018

Fixed by changing HardWire mWire(2); to TwoWire mWire(2);

Now I get error 4 (other error) at mWire.endTransmission() in setRegister function. mWire.write reports 1 byte written for both addr and val.

@stevstrong
Copy link
Owner

Please post the complete error messages.

@kozuch
Copy link
Author

kozuch commented Aug 15, 2018

It now compiles without error, I get the error 4 value at runtime by printing it to serial - I put logging in CameraOV7670Registers.cpp in bool CameraOV7670Registers::setRegister(uint8_t addr, uint8_t val) function. mWire.endTransmission() simply returns 4 instead of 0. I guess this is an I2C problem. I am not sure if my camera is not dead, but I have 2 of them and both giving the same error. I think I connected everything correctly, additionally tried on camera the RESET pin to 3.3V and PWDN to ground, did not help.

I have a little different camera module than is usual - my camera is similar to the image on the left here, while the camera from the various videos is usually the one on the right: https://forum.arduino.cc/index.php?topic=535819.0

Exact photos of my camera:
https://photos.app.goo.gl/vUySrQZJQJDwMZvx5

@stevstrong
Copy link
Owner

I will check this soon.

@kozuch
Copy link
Author

kozuch commented Aug 19, 2018

Thanks, but you don't have to any more. The problem was you used i2c bus #2 in code but your pin wiring uses bus #1. This code change fixes it:

TwoWire mWire(1);

Now the camera inits already.

@stevstrong
Copy link
Owner

9829eaf should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants