Topics
- Scanning I2C Devices
- Intro to C++
Scanning I2C devices
The project could involve multiple I2C devies so it ain't no good to have the same adress for them. I setup the devices I would be using. Then, I started scanning. First was the EEProm.
Next I scanned the load sensor. It wasn't an I2C device because nothing showed up. Moving onto the IMU board and I found two addresses for this device.
I will have to also scan the SD card because I believe that follows the same I2C routine.
I looked it up. SD cards use a different routine, SPI. This is good. I shouldn't have any any conflict between the devices I will use.
EEProm: 0x50
IMU : 0x68; 0x76
Introduction to C++
The first modification was to watch the keyboard and wait for inputs. I made, what I consider, a simple solution. What I got back was a cascade of errors.
Because they looked to be something other than a syntax error, I tried running the running the program on two different online compilers. These gave me even more errors. Even when I ran the program right of the book. first image is Jdoodle; second is C++shell.
I changed one thing, the "int' declaration of the "i" in my for loop and most of the errors were resolved. Not sure why.
I tried doing the same thing with a while loop. This gave more errors than the for loop.
I used the program introduced in class today; that allowed me to do what needed doing. I ended up doing two ways to input the values because my original cin had an endl at the end and I didn't realize that was the problem. Pointers work just fine here. I tested what I had by putting in the original values.
I was able to figure out the problem. I left out some brackets and as well as not having the correct value for ending the for loop.
Next, I was to compute the minimum distance between the hands. I made a new function to call at the end. I had to change some values in order for the function to work because two of the numbers were the same.
The next part was the find multiple instances of the same min value. I used the same structure while and compared those values to the min value I find before hand. Then I simple scroll through the values and array and find what I need.

No comments:
Post a Comment