$3 Alternative to Makey Makey

7,634

37

36

Introduction: $3 Alternative to Makey Makey

The Makey Makey is a great little device that emulates a USB keyboard and lets you make keys out of any somewhat conductive thing (aluminum foil, bananas, play dough, etc.), which can then be used as a controller for games and educational projects. The Makey Makey has two downsides: (1) cost and (2) the need for a ground connection.

This project is a cheap alternative using a $2 STM32F1 board and capacitive sensing. It only has 10 inputs as opposed to the Makey Makey's 12, but it has the advantage that in addition to emulating a keyboard, it can emulate a USB gamepad controller (digital joystick).

Parts:

  • "black pill" STM32F103c8 board ($1.90 on Aliexpress; more information here)
  • breadboard (less than $1 on Aliexpress) and jumper wires; or just a bunch female-to-male dupont connectors ($0.70 on Aliexpress for a pack of 40)
  • paperclips, alligator clips, etc.

Tools:

  • computer
  • UART-to-USB adapter for initial board programming (an Arduino Uno or Mega will do the job, as will a cheap CH340 unit)
  • soldering iron for soldering headers to board (you can also use a bunch of test clips without soldering, but they sometimes fall out)

The software is an example sketch included with my ADCTouchSensor library which allows for capacitive sensing with a single pin on the STM32F1 board per sensor (it's based on martin2250's library for AVR).

Warning: In dry weather, or where static is an issue (e.g., on a carpet), don't touch the exposed metal connectors lest you cause electrostatic damage to the STM32F1 board. I expect that the resistance of potatoes, bananas, play dough, etc. will help protect the board, but if you use bare aluminum foil, you might have problems. On the other hand, the board is only $1.90.

Educational activity ideas:

  • Experiment to find out what items are conductive and can be used as control surfaces. (E.g., pencil lead vs. crayon; play dough vs. candle.)
  • Write Scratch games that use a home-made controller.
  • Modify the Arduino code powering the project to allow mouse click/movement, other keys, more than four joystick directions, etc.

Step 1: Install Bootloader on Development Board

Solder the two three-pin headers in the middle of the Black Pill development system (B0-/center/B0+; B1-/center/B1+), and the long headers along the edges (if you're in a hurry, or want to avoid unnecessary pins that may confuse kids, you just need pins for A0-A10 and G).

You need a UART to USB bridge that is compatible with 3.3v devices. You can order a ch340 from Aliexpress for $0.66, but I had an Arduino Mega knockoff sitting around, and there was a cool trick I found online. If on an Arduino you short the reset pin to ground with a short wire, then it becomes a UART to USB bridge--no sketch needed. The only trick is that the RX and TX labeling becomes reversed: the Arduino's "RX" pin transmits and its "TX" pin receives. The Arduino runs at 5v and the Black Pill at 3.3v, but the PA9 and PA10 pins on the stm32f103 are 5V tolerant according, so that shouldn't be a problem.

On the headers you soldered, put a jumper from B0+ to center and from B1- to center.

Make the following connections:

  • PA9 to UART bridge RX ("TX" if you're using the Arduino trick)
  • PA10 to UART bridge TX ("RX" if you're using the Arduino trick)
  • G to UART bridge ground

You can use a breadboard, or male-to-female jumpers, or if you want to do it before you solder the headers, you can use test clips (as in photo).

Download the bootloader binary. You want generic_boot20_pb12.bin.

On Windows, install ST's Flash Loader Demonstrator. On Linux (and maybe OS X and even Windows if you prefer commandline tools), use this python script instead, but my instructions will be for Windows. Connect your UART bridge to your computer.

Power up the Black Pill via its USB port (if you use the computer, it will likely complain about an unrecognized USB device; ignore that). Start the Flash Loader Demonstrator. Choose the COM port for your UART bridge. Choose "Remove protection" if available. Choose a 64kb rather than 128kb flash version. And upload the bootloader binary.

Unpower everything and then move the jumper from B0+/center to B0-/center. You now have a bootloader that you can use with the Arduino IDE.

Step 2: Set Up Arduino IDE

I assume you have the latest Arduino IDE installed.

In Tools | Boards | Boards Manager, install support for the Arduino Zero (just put Zero in the search, click on the found entry, and then Install). Yes, you aren't working with a Zero, but this will install the right gcc compiler.

Next, download the stm32duino core. On Windows, I recommend downloading the zip file, since when I checked out the files (admittedly, with svn), I had some permissions problems with files in the Windows tools directory that needed fixing. Put the branch in Arduino/Hardware/Arduino_STM32 (so you'll have folders like Arduino/Hardware/Arduino_STM32/STM32F1, etc.) On Windows, install drivers by running drivers\win\install_drivers.bat.

Step 3: Install CapacitiveController Sketch

In Arduino IDE, choose Sketch | Include Library | Manage Libraries. Search for "ADCTouchSensor" and install version 0.0.6 or newer. Repeat and search for "USBHID" and install my USBHID_stm32f1 library.

Choose File | Example | ADCTouchSensor | CapacitiveController.

Make sure you have the following settings under Tools:

  • Board: Generic STM32F103C8
  • Upload method: STM32duino Bootloader

Plug the board into the computer and click the right-arrow "upload" button. You may need to reset the board (press the reset button on it) once the upload message shows up in the console.

Step 4: Connections and Buttons

With the device unplugged, run wires from the STM32F1 pins to your control surfaces. Connect with alligator clips, paperclips, or just by sticking jumpers into objects. You can use a breadboard or female-to-male jumpers. For Tetris on the computer, we used keyboard mode and the arrow keys; for Pac Man on the tablet, we used a USB OTG cable and joystick mode.

The CapacitiveController sketch calibrates the capacitive sensors when it's turned on. Make sure that while you're turning it on, you aren't touching the control surfaces, wires to them or pins. And if you modify any control surface, you need to re-calibrate by unplugging and plugging back in or pressing the white reset button on the board.

Most of the apps here will work, as well as many others. You can also see how many Makey Makey projects you can adapt.

Some good control surfaces:

  • fruits and vegetables
  • play dough
  • aluminum foil (except in high static conditions)
  • heavily penciled buttons/connections on paper (the connection lines shouldn't be too long--in the photo, the bottom-most button didn't work)
  • experiment with many more! (you can also try to tweak the 25 in if (sensors[i]->read() > 25) line in the source code for some surfaces)

Keyboard mode connections:

  • Leave A10 disconnected
  • A0: space
  • A1: up
  • A2: left
  • A3: down
  • A4: right
  • A5: w
  • A6: a
  • A7: s
  • B0: d
  • B1: f

Gamepad/Joystick mode connections:

  • Connect A10 to Ground (G) to set joystick mode
  • A0: button 1
  • A1: up
  • A2: left
  • A3: down
  • A4: right
  • A5-A7,B0,B1: buttons 2-6

Hint:

If you are using male-to-female jumpers, you can do the joystick mode A10-ground connection by jamming the male ends of two jumpers into each other, thereby forming a female-to-female jumper.

Hand Tools Only Contest 2017

Participated in the
Hand Tools Only Contest 2017

Teachers Contest 2017

Participated in the
Teachers Contest 2017

Be the First to Share

    Recommendations

    • Hide It Challenge

      Hide It Challenge
    • Made with Math Contest

      Made with Math Contest
    • Laser Challenge

      Laser Challenge

    36 Comments

    0
    LindseyO9
    LindseyO9

    7 months ago on Introduction

    I've bought dozens of MaKeys over the years for my classroom, and I've GOT to find a more budget friendly option! Does this set on Amazon get the job done? Looks like two of the boards, and a programmer: https://www.amazon.com/Aideepen-ST-Link-V2-Program...

    I've been using ATTiny85s and the SparkFun Tiny programmer, so that's the type of programmer I'm used to... I'm not immediately understanding how to plug this STM32F103C8 into the ST-Link V2 Programmer... looks like the female-to-female jumpers? But which pins?

    0
    arpruss
    arpruss

    Reply 7 months ago

    I don't have an ST-Link and so I don't know how to use it. And your Amazon link doesn't work.
    I usually just upload the initial bootloader with a serial-to-USB adapter of some kind, and after that the firmware can be uploaded directly over USB. You can buy one for a dollar or two on aliexpress. Amazon has some, too, such as these: https://smile.amazon.com/HiLetgo-Module-Microcontr...

    0
    LindseyO9
    LindseyO9

    Reply 7 months ago

    Amazon links have been fighting with me for some reason... I picked up an ST-Link v2, and once in hand the connections from the ST-Link pins to the Blue Pill are clear. It seems to talk to the Blue Pill well! I followed this guide and got the Blink sketch to work, including with tweaking the blink speed! Yay!

    I installed your "ADCTouchSensor" library, and searched for "USBHID" and installed the only USBHID library that appeared... the author was "various," and in the description it specified the stm32f1, but the library title wasn't "USBHID_stm32f1." "More info" sent me to your USBComposite_stm32f1 on Github, so seemed like still probably the right way to go...

    Then I tried to upload the CapacitiveController sketch using the same Board, Upload Method, etc that worked for Blink, but got the following error message:
    -----------------------------------------------------------
    Arduino: 1.8.10 (Windows 10), Board: "Generic STM32F1 series, BluePill F103C6 (32K), STM32CubeProgrammer (SWD), Enabled (generic 'Serial'), None, Low/Full Speed, Smallest (-Os default), Newlib Nano (default)"
    Multiple libraries were found for "ADCTouchSensor.h"
    In file included from C:\...\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:2:
    Used: C:\...\Arduino\libraries\ADCTouchSensor
    C:\...\Arduino\libraries\USBHID/USBComposite.h:4:10: fatal error: boards.h: No such file or directory
    4 | #include <boards.h>
    | ^~~~~~~~~~
    Multiple libraries were found for "USBComposite.h"
    compilation terminated.
    Used: C:\...\Arduino\libraries\USBHID
    exit status 1
    Error compiling for board Generic STM32F1 series.
    ---------------------------------------------------

    I recognize that this is totally like "I switched out sugar for salt on this recipe, and now it's not delicious!" but I'm wondering if there might be something obvious I'm missing... It seems like at least some of the errors are with the libraries rather than with the ST-Link. And the "#include <USBComposite.h>" in the sketch isn't orange, but "#include <ADCTouchSensor.h>" is... so is something amiss with the libraries?

    Thanks for all your care in developing this!

    0
    arpruss
    arpruss

    Reply 7 months ago

    The last time someone had a boards.h error, they turned out to be using PlatformIO instead of the Arduino IDE.

    You shouldn't need to install USBHID separately, since that's now included in Roger's stm32duino core.

    You can also just download my binaries, and install using the same method you used for the Bootloader (e.g., using the STM Demonstrator). Here are the binaries:
    http://pruss.mobi/CapacitiveController_PB12.bin
    http://pruss.mobi/CapacitiveController_PC13.bin
    Choose the one that matches the pin your LED is on. BluePill is PC13.

    0
    LindseyO9
    LindseyO9

    Reply 7 months ago

    Oof... okay, I'm learning a lot!

    I'm using Arduino IDE 1.8.13 (windows store 1.8.42.0)

    I used this YouTube video to figure out what ST-Link utility I needed and how to use it, and used it to burn your PC13.bin binary... I was also really excited to find this post that explained what "Boot0 jumper set to 1" means!

    Blink still behaves perfectly when I use upload method STLink. But when I use the upload method "STM32duino bootloader," either through the STLink or through the micro USB, I get these errors:
    ------------------------------------------------
    maple_loader v0.1
    Resetting to bootloader via DTR pulse
    Reset via USB Serial Failed! Did you select the right serial port?
    Searching for DFU device [C:\Users\lown\AppData\Local\Temp\arduino_build_424735/Blink.ino.bin]...
    Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...
    dfu-util - (C) 2007-2008 by OpenMoko Inc.
    Couldn't find the DFU device: [C:\Users\lown\AppData\Local\Temp\arduino_build_424735/Blink.ino.bin]
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    timeout waiting for 2 serial
    ------------------------------------------------------------

    I get the same "perpetual bootloader mode" messages when I try to upload CapacitiveController via STM32duino bootloader... no changes. Previous Blink upload keeps running.

    When I try to upload CapacitiveController via upload method "STLink," it says that it's successful and the application started... whatever the most recent Blink I uploaded stops (no more PC13 LED blinking). But nothing else happens... PC13 doesn't turn on when I touch any of the buttons, no keyboard behavior. Unplugging and replugging STLink, switching to micro USB, etc. No change.

    One other piece of data: When I plug in via the STLink, my device manager identified the STM32 STLink as a Universal Serial Bus device, and makes the lovely "I found new hardware!" boop sound. When I plug in via the micro USB in the same USB port on my computer, no boop sound and no new item in my device manager under either Human Interface Devices or any USB categories.

    Thank you!

    0
    arpruss
    arpruss

    Reply 7 months ago

    Glad it works. If you're just uploading the same .bin file, it shouldn't take long.

    But tell me a little bit about the educational activities you mean to use this for. Before the pandemic, I used to teach a summer coding class to gifted middle schoolers, and I'm always looking for new things to do with them.

    0
    LindseyO9
    LindseyO9

    Reply 7 months ago

    We do tons of stuff with MaKeys and Scratch! Carnival games for our big all-school Halloween carnival, interactive dioramas for world language classes, museum exhibits for all sorts of stuff... ancient civilizations, paleontology research projects... Our 5th graders are going to make Operation-like games as part of their human body unit in science. And covid, hence I need one capacitive controller per child! My next step is to try to make a 3D printed case for it... Several options on Thingiverse, and I'm working on modifying one to be MaKey-like.

    You can see a bunch of our projects at our school makerspace twitter account... https://twitter.com/EvergreenBIGLab We've been playing with ATTiny85s and addressable LEDs and other fun stuff lately, too! ("Lately"... like up until a year ago. *sigh*)

    0
    arpruss
    arpruss

    Reply 7 months ago

    Try building one of the keyboard demos in the USBComposite library examples and uploading that to the device and see if that gets recognized.

    0
    LindseyO9
    LindseyO9

    Reply 7 months ago

    Oh my god you're going to be so disappointed when you hear what the problem was... I was using a charge-only micro USB cable. *facepalm* I switched to a data cable, and it worked beautifully! Got a nice clue right when I plugged it in when I got the lovely "found new hardware!" boop. Uploaded CapacitiveController via STLink, then switched over to the USB cable, and lo I could play the MaKey MaKey demo bongos!

    I tried looking at some of the keyboard demos... simplekeyboard and keyboardwithLEDs, but I couldn't find any documentation that would tell me which pins do what. I found Dan Drown's 2 button keyboard, but I didn't have the patience to type in his code manually, since it's just in there as a screenshot...

    Anyway, thank you thank you thank you! The STLink pack I got from Amazon has two blue pills, so now I'm going to see how quick it is to flash another one... I need to make like 15, and get them mounted on something usable by my hoard of 5th graders!

    0
    LindseyO9
    LindseyO9

    Reply 7 months ago

    Aha! I got it to upload! I used the Board Manager links for the ST Link here, which let me set the right board and upload method. Arduino at least tells me that CapacitiveController successfully uploaded!

    I switched over to the micro USB to try out the sketch, and opened MaKey's simple bongo app... Just a space bar to play the drum. I was hoping I could just touch a header pin at A0 with my finger, but no response yet... unplugged and replugged a couple times. Is it like the original MaKey where you have to touch both ground and your button, or just the button? Also tried a header pin at G to the far left of A0. Neither way worked yet. I also tried lowering the "if (sensors[i]->read() > 25" to 10, and to 1. Finally, I tried just a jumper wire straight from A0 to G, in case my sweaty hands somehow weren't conductive enough, but nope.

    Blink still works!

    Any thoughts are appreciated. Thank you!

    0
    arpruss
    arpruss

    Reply 7 months ago

    It's capacitive, so you just need to touch the pin.
    Does the LED turn on when you touch the pin? It should.
    Also, does the device show up as a Human Interface Device in the Windows Device Manager?
    You can also check if the device shows up as a joystick in the Game Controllers panel (joy.cpl).

    0
    JuzztMe
    JuzztMe

    Question 11 months ago

    This project looks awesome, so thanks! I'm building it right now. It was a bumpy journey so far but I'm almost there I guess. I'm at Step 3 and installed the libraries. I chose File | Example | ADCTouchSensor | CapacitiveController. So far, so good.

    Then you wrote "Make sure you have the following settings under Tools:
    • Board: Generic STM32F103C8
    • Upload method: STM32duino Bootloader
    • USB type: Keyboard + Mouse + Joystick"
    But when I click on Tools | Board, I see all kinds of Arduino's but no STM32F103C8. I also can't find both 'Upload method' and 'USB type'. I tried Arduino Nano and Zero but no luck because during uploading it says something like 'fault while compiling for board'.

    So how can I fix this problem? I'd love for it to work! :)
    0
    arpruss
    arpruss

    Answer 11 months ago

    It sounds to me like you didn't put the files from the stm32duino core in the correct directory (See Step 2). Or maybe you just need to restart the Arduino IDE.

    0
    JuzztMe
    JuzztMe

    Reply 10 months ago

    Hey Arpruss,
    Thanks so much for your reply, this is very helpfull! I didn't totally get step 2, but with some trial and error, I made it work with the whole directory-stuff. So that is fixed.

    Now there is a new problem. The board and upload method are being showed in Arduino IDE-Tools. The only thing missing is 'USB type'. So when I try to upload now, I get an error "reference to 'prev' is ambiguous" in some if-loop what seems to be about the joystickmode. How can I get the 'USB type' option under Tools?

    0
    arpruss
    arpruss

    Reply 10 months ago

    The USB type is a leftover from a previous version. Don't worry about it.

    Post your complete error log. I can't duplicate your "prev" error.

    0
    JuzztMe
    JuzztMe

    Reply 10 months ago

    Hey Arpruss,

    Thanks for taking a look at my error log!
    Here it is:

    Arduino:1.8.13 (Windows 10), Board:"Generic STM32F103C6/fake STM32F103C8, STM32duino bootloader, 72Mhz (Normal), Smallest (default)"
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:12:0: warning: "LED_BUILTIN" redefined
    #define LED_BUILTIN PB12 // change to match your board
    In file included from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:42:0,
    from sketch\CapacitiveController.ino.cpp:1:
    F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c/variant.h:20:0: note: this is the location of the previous definition
    #define LED_BUILTIN PC13
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino: In function 'void setup()':
    CapacitiveController:57:9: error: reference to 'prev' is ambiguous
    prev[i] = 0;
    ^~~~
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:19:10: note: candidates are: unsigned int prev [10]
    unsigned prev[NUM_PINS];
    ^~~~
    In file included from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:66:0,
    from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\algorithm:61,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish_math.h:109,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish.h:60,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:30,
    from sketch\CapacitiveController.ino.cpp:1:
    c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_iterator_base_funcs.h:220:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)
    prev(_BidirectionalIterator __x, typename
    ^~~~
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino: In function 'void loop()':
    CapacitiveController:88:14: error: reference to 'prev' is ambiguous
    if(!prev[i]) {
    ^~~~
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:19:10: note: candidates are: unsigned int prev [10]
    unsigned prev[NUM_PINS];
    ^~~~
    In file included from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:66:0,
    from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\algorithm:61,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish_math.h:109,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish.h:60,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:30,
    from sketch\CapacitiveController.ino.cpp:1:
    c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_iterator_base_funcs.h:220:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)
    prev(_BidirectionalIterator __x, typename
    ^~~~
    CapacitiveController:90:12: error: reference to 'prev' is ambiguous
    prev[i] = 1;
    ^~~~
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:19:10: note: candidates are: unsigned int prev [10]
    unsigned prev[NUM_PINS];
    ^~~~
    In file included from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:66:0,
    from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\algorithm:61,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish_math.h:109,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish.h:60,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:30,
    from sketch\CapacitiveController.ino.cpp:1:
    c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_iterator_base_funcs.h:220:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)
    prev(_BidirectionalIterator __x, typename
    ^~~~
    CapacitiveController:104:13: error: reference to 'prev' is ambiguous
    if(prev[i]) {
    ^~~~
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:19:10: note: candidates are: unsigned int prev [10]
    unsigned prev[NUM_PINS];
    ^~~~
    In file included from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:66:0,
    from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\algorithm:61,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish_math.h:109,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish.h:60,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:30,
    from sketch\CapacitiveController.ino.cpp:1:
    Meerdere bibliotheken gevonden voor "USBComposite.h"
    Gebruikt: F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\libraries\USBComposite
    Niet gebruikt: F:\Documenten\Arduino\libraries\USBHID
    c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_iterator_base_funcs.h:220:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)
    prev(_BidirectionalIterator __x, typename
    ^~~~
    CapacitiveController:106:12: error: reference to 'prev' is ambiguous
    prev[i] = 0;
    ^~~~
    F:\Documenten\Arduino\libraries\ADCTouchSensor\examples\CapacitiveController\CapacitiveController.ino:19:10: note: candidates are: unsigned int prev [10]
    unsigned prev[NUM_PINS];
    ^~~~
    In file included from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:66:0,
    from c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\algorithm:61,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish_math.h:109,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/wirish.h:60,
    from F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:30,
    from sketch\CapacitiveController.ino.cpp:1:
    c:\users\sydho\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_iterator_base_funcs.h:220:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)
    prev(_BidirectionalIterator __x, typename
    ^~~~
    exit status 1
    reference to 'prev' is ambiguous

    0
    arpruss
    arpruss

    Reply 10 months ago

    Try replacing "prev" with "previous" everywhere in the file and see if it then compiles. I think you have a newer version of gcc than I.

    0
    JuzztMe
    JuzztMe

    Reply 10 months ago

    That helped. So those errors are gone. Still two more to go. Thanks for your time so far. I would be glad to pay you a little for your time! Let me know your paypal or something.
    Here is the new error log. I've translated some things to english:

    Arduino:1.8.13 (Windows 10), Board:"Generic STM32F103C6/fake STM32F103C8, STM32duino bootloader, 72Mhz (Normal), Smallest (default)"

    c:/users/sydho/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\sydho\AppData\Local\Temp\arduino_build_364804/Projectje.ino.elf section `.rodata' will not fit in region `rom'

    c:/users/sydho/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: region `rom' overflowed by 140 bytes

    collect2.exe: error: ld returned 1 exit status

    Found multiple libraries for "USBComposite.h"

    Used: F:\Documenten\Vocal Leadership\Solfa machine\arduino-1.8.13\hardware\Arduino_STM32\STM32F1\libraries\USBComposite

    Not used: F:\Documenten\Arduino\libraries\USBHID

    exit status 1

    Error compiling for board Generic STM32F103C6/fake STM32F103C8

    0
    arpruss
    arpruss

    Reply 10 months ago

    This should be an easy one. Select "Generic STM32F103C8" instead of "Generic STM32F103C6/fake STM32F103C8". (Unless you have the bad luck of having a fake C8 with less memory, in which case I will have to think how to optimize the code and make it fit in the fake C8's memory.)

    My paypal address is arpruss at gmail dot com. But please don't feel the least obligation: I am doing well financially, and I enjoy helping people.

    0
    JuzztMe
    JuzztMe

    Reply 10 months ago

    Would that be the problem? Because even when I don't connect the black pill, it still gives the same error, so compiling seems to be the problem. I don't have the option for selecting a C8, only the c6/fake c8. So that 'preset' could be the problem; the c8 simply isn't there..... I looked up the specs of my 'black pill' and it seems to have the same as yours (https://nl.aliexpress.com/item/4000018885169.html?... I don't think memory is a problem, right? I can order some new ones thru your link, if that solves the problem but to me it seems to be the problem that I don't have the c8 option to select...

    Awesome that you're willing to help me out, I really appreciate that! :)