Files
Filessoftware | |
---|---|
.. | |
binaries | |
libraries | |
sketches | |
README.md |
README.mdMCP Library
In order to compile sketches using the MCP49 DAC, you have to download the library here and install it in your Arduino library. Also note that some instructions used in the fac_drums were deprecated on the newest Arduino IDE, so you need to compile and upload them on the older.
You need to do a small tweak on the code in order to work properlly, this is because this new DAC uses SPI. This is based on the Euroardcore but with the mcp4921 has been fully tested :
- you need to add to the beggining of any sketch using the DAC,
#include <SPI.h> #include <DAC_MCP49xx.h> DAC_MCP49xx dac(DAC_MCP49xx::MCP4921, 10);
- also you need to add the following code at the end of the setup() so the DAC is properlly initialized:
dac.setBuffer(true); // Set FALSE for 5V vref. dac.setGain(1); // "1" for 5V vref. "2" for 2.5V vref. dac.setPortWrite(true);
- and finally replace the dacOutput() and dacOutputfast() to be something like:
void dacOutput(long v) { dac.outputA(v); }
Compiling the sketches of this repo
I'm using arduino 1.0.6 to compile all fac_drum sketches, it may be possible to use newer arduino versions on the rest of the sketches.
In the libraries folder you can find the library I'm currently using to compile all the sketches with the MCP (dac).
In my case I'm using Arduino with sudo command (to let read/write USB ports for the programmer), so my sketbook is located at /root/sketchbook and here is were I coped the DAC_MCP49xx library.
[root@boxita sketchbook]# tree
.
└── libraries
├── DACMCP49xx
│ ├── DACMCP49xx.cpp
│ ├── DACMCP49xx.h
│ ├── examples
│ │ ├── MCP49x1singledemo
│ │ │ └── MCP49x1singledemo.ino
│ │ └── MCP49x2dualdemo
│ │ └── MCP49x2dual_demo.ino
│ ├── keywords.txt
│ └── README.txt
└── readme.txt
5 directories, 8 files [root@boxita sketchbook]#
Uploading hex using avrdude and your AVRISP mkII.
To upload the file directly you can try the following command, I'm doing this on linux (Arch) so depending on your system configuration you may need to sudo the command. Remember to burn the fuses as explained in the building guide.
$ avrdude -c avrispmkII -p ATmega328P -e -U flash:w:facfmosc.cpp.hex