diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0c3a67e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ + +# Ignore Visual Studio compiled files +Debug/ +Release/ \ No newline at end of file diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/.suo b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/.suo new file mode 100644 index 0000000..d6dc408 Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/.suo differ diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/Browse.VC.db b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/Browse.VC.db new file mode 100644 index 0000000..c43bdf6 Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/Browse.VC.db differ diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/256f465c032f3a3d/.BABITO2ANNIVERSARY.VSARDUINO.ipch b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/256f465c032f3a3d/.BABITO2ANNIVERSARY.VSARDUINO.ipch new file mode 100644 index 0000000..ba9c114 Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/256f465c032f3a3d/.BABITO2ANNIVERSARY.VSARDUINO.ipch differ diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/2af0abe583c68cdb/.BABITO2ANNIVERSARY.VSARDUINO.ipch b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/2af0abe583c68cdb/.BABITO2ANNIVERSARY.VSARDUINO.ipch new file mode 100644 index 0000000..395da5b Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/2af0abe583c68cdb/.BABITO2ANNIVERSARY.VSARDUINO.ipch differ diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/3c19b9977f65f591/.BABITO2ANNIVERSARY.VSARDUINO.ipch b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/3c19b9977f65f591/.BABITO2ANNIVERSARY.VSARDUINO.ipch new file mode 100644 index 0000000..40ac661 Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/3c19b9977f65f591/.BABITO2ANNIVERSARY.VSARDUINO.ipch differ diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/7378fcb20f861fb5/BABITO2ANNIVERSARY.ipch b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/7378fcb20f861fb5/BABITO2ANNIVERSARY.ipch new file mode 100644 index 0000000..ebf0b00 Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/7378fcb20f861fb5/BABITO2ANNIVERSARY.ipch differ diff --git a/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/dbe48673e755e0d3/BABITO2ANNIVERSARY.ipch b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/dbe48673e755e0d3/BABITO2ANNIVERSARY.ipch new file mode 100644 index 0000000..adbed29 Binary files /dev/null and b/Gaia2Anniversary/.vs/Babito2Anniversary/v16/ipch/AutoPCH/dbe48673e755e0d3/BABITO2ANNIVERSARY.ipch differ diff --git a/Gaia2Anniversary/Babito2Anniversary.sln b/Gaia2Anniversary/Babito2Anniversary.sln new file mode 100644 index 0000000..a94ebc7 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Babito2Anniversary", "Babito2Anniversary\Babito2Anniversary.vcxproj", "{C5F80730-F44F-4478-BDAE-6634EFC2CA88}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.ActiveCfg = Debug|Win32 + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.Build.0 = Debug|Win32 + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.ActiveCfg = Release|Win32 + {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CD189DD9-6307-4336-A20E-864FE03CC2B6} + EndGlobalSection +EndGlobal diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.ino b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.ino new file mode 100644 index 0000000..be7721e --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.ino @@ -0,0 +1,143 @@ +/* + Name: Babito2Anniversary.ino + Created: 01/01/2021 15:36:29 + Author: Lorenzo Dellacà +*/ + +#include + +const int buzzerPin = 6; +const int servoPin = 9; + +const int pause = 0; +const int c = 261; +const int d = 294; +const int e = 329; +const int f = 349; +const int g = 391; +const int gS = 415; +const int a = 440; +const int aS = 455; +const int b = 494; +const int cH = 523; +const int cSH = 554; +const int dH = 587; +const int dSH = 622; +const int eH = 659; +const int fH = 698; +const int fSH = 740; +const int gH = 784; +const int gSH = 830; +const int aH = 880; + +const int alpiniNotes[] = +{ + c,g,e,e,c,g,e,e,e,d,e,f,d,pause, + d,e,f,f,f,g,a,a,a,g,f,e,pause,g,g,e,pause, + + c,g,e,e,c,g,e,e,e,d,e,f,d,pause, + d,e,f,f,f,g,a,a,a,g,f,e,pause,g,g,e,pause, + + e,f,g,a,a,pause,cH,b,a,g,g,pause,e,f,g,a,a,cH,cH,b,a,g,g,pause, + e,f,g,a,a,pause,cH,b,a,g,g,pause,e,f,g,a,a,b,b,cH,pause, + + pause +}; +const int alpiniDurations[] = +{ + 500,500,250,250,250,250,250,125,125,250,250,500,500,1000, + 500,500,250,250,250,250,250,125,125,250,250,500,50,375,125,500,1000, + + 500,500,250,250,250,250,250,125,125,250,250,500,500,1000, + 500,500,250,250,250,250,250,125,125,250,250,500,50,375,125,500,1000, + + 250,250,250,500,500,250,250,250,250,500,500,250,250,250,250,500,500,375,125,250,250,500,500,500, + 250,250,250,500,500,250,250,250,250,500,500,250,250,250,250,500,500,500,500,1000,1000, + + 10000 +}; + +int alpiniMusicSize = 0; + +int musicPosition = 0; + +unsigned long currentMillis; +unsigned long lastMillisNote = 0; +unsigned long lastMillisServo = 0; + + +Servo servo; +int servoAngle = 90; + + +void setup() { + + pinMode(buzzerPin, OUTPUT); + pinMode(servoPin, OUTPUT); + + servo.attach(servoPin); + servo.write(servoAngle); + + currentMillis = millis(); + lastMillisNote = millis(); + + alpiniMusicSize = ((sizeof(alpiniNotes) / sizeof(alpiniNotes[0]))); + +} + +void loop() { + + openLid(0.7f); + + playMusic(0.7f); + + currentMillis = millis(); +} + +void openLid(float speed) +{ + if (currentMillis >= lastMillisServo + (100.0 * 1/speed)) + { + if (servoAngle >= 0) + { + servoAngle--; + } + + if (servoAngle > 0) + { + servo.write(servoAngle); + } + else + { + servo.detach(); + } + + lastMillisServo = millis(); + } +} + + +void playMusic(float speed) +{ + if (currentMillis >= lastMillisNote + alpiniDurations[musicPosition - 1] * 1 / speed) + { + noTone(buzzerPin); + + if (!(alpiniNotes[musicPosition] == pause)) + { + tone(buzzerPin, alpiniNotes[musicPosition], (alpiniDurations[musicPosition] * 1 / speed) - 10); + } + + + if (musicPosition < alpiniMusicSize) + { + musicPosition++; + } + else + { + musicPosition = 0; + } + + lastMillisNote = millis(); + } +} \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skb b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skb new file mode 100644 index 0000000..f41aac5 Binary files /dev/null and b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skb differ diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skp b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skp new file mode 100644 index 0000000..b7dafd9 Binary files /dev/null and b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skp differ diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj new file mode 100644 index 0000000..39f2287 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C5F80730-F44F-4478-BDAE-6634EFC2CA88} + Babito2Anniversary + Babito2Anniversary + + + + Application + true + MultiByte + + + + + Application + false + true + MultiByte + + + + + Application + true + MultiByte + + + + + Application + false + true + MultiByte + + + + + Application + false + true + MultiByte + v141 + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + $(ProjectDir)..\Babito2Anniversary;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\libraries\Servo\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;$(ProjectDir)..\..\..\ARDUIN~1\GAIA2A~1\BABITO~1;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\\lib\gcc\avr\7.3.0\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\\lib\gcc\avr\7.3.0\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include-fixed;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories) + $(ProjectDir)__vm\.Babito2Anniversary.vsarduino.h;%(ForcedIncludeFiles) + true + __AVR_atmega328p__;__AVR_ATmega328P__;__AVR_ATmega328p__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=108013;ARDUINO_AVR_UNO;ARDUINO_ARCH_AVR;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions) + + + true + + + + + Level3 + MaxSpeed + true + true + true + $(ProjectDir)..\Babito2Anniversary;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\libraries\Servo\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;$(ProjectDir)..\..\..\ARDUIN~1\GAIA2A~1\BABITO~1;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\\lib\gcc\avr\7.3.0\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\\lib\gcc\avr\7.3.0\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include-fixed;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories) + $(ProjectDir)__vm\.Babito2Anniversary.vsarduino.h;%(ForcedIncludeFiles) + __AVR_atmega328p__;__AVR_ATmega328P__;__AVR_ATmega328p__;F_CPU=16000000L;ARDUINO=108013;ARDUINO_AVR_UNO;ARDUINO_ARCH_AVR;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions) + + + true + true + true + + + + + + + VisualMicroDebugger + + + + CppCode + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj.filters b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj.filters new file mode 100644 index 0000000..b19a287 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj.filters @@ -0,0 +1,28 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + xml;json;txt;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + Misc Files + + + + + Header Files + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj.user b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary1.skp b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary1.skp new file mode 100644 index 0000000..a3290e8 Binary files /dev/null and b/Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary1.skp differ diff --git a/Gaia2Anniversary/Babito2Anniversary/__vm/.Babito2Anniversary.vsarduino.h b/Gaia2Anniversary/Babito2Anniversary/__vm/.Babito2Anniversary.vsarduino.h new file mode 100644 index 0000000..55ce1c9 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/__vm/.Babito2Anniversary.vsarduino.h @@ -0,0 +1,93 @@ +/* + Editor: https://www.visualmicro.com/ + This file is for intellisense purpose only. + Visual micro (and the arduino ide) ignore this code during compilation. This code is automatically maintained by visualmicro, manual changes to this file will be overwritten + The contents of the _vm sub folder can be deleted prior to publishing a project + All non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!). + Note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again + + Hardware: Arduino Uno, Platform=avr, Package=arduino +*/ + +#if defined(_VMICRO_INTELLISENSE) + +#ifndef _VSARDUINO_H_ +#define _VSARDUINO_H_ +#define __AVR_atmega328p__ +#define __AVR_ATmega328P__ +#define __AVR_ATmega328p__ +#define F_CPU 16000000L +#define ARDUINO 108013 +#define ARDUINO_AVR_UNO +#define ARDUINO_ARCH_AVR +#define __cplusplus 201103L +#define _Pragma(x) +#define __AVR__ +#define __inline__ +#define __asm__(...) +#define __extension__ +#define __inline__ +#define __volatile__ +// Redefine __cplusplus to correct version: https://www.visualmicro.com/forums/YaBB.pl?num=1592217268 +#undef __cplusplus +#define __cplusplus 201103L + +//#define GCC_VERSION 40902 +//https://www.visualmicro.com/forums/YaBB.pl?num=1569762585/5#5 +#define __GNUC__ 5 +#define __GNUC_MINOR__ 4 +#define __GNUC_PATCHLEVEL__ 0 +#define GCC_VERSION ((__GNUC__*10000)+(__GNUC_MINOR__*100)+__GNUC_PATCHLEVEL__)) + + +#define volatile(va_arg) +#define _CONST +#define __builtin_va_start +#define __builtin_va_end +#define __attribute__(...) +#define NOINLINE __attribute__((noinline)) +#define prog_void +#define PGM_VOID_P int + + +#ifndef __builtin_constant_p + #define __builtin_constant_p __attribute__((__const__)) +#endif +#ifndef __builtin_strlen + #define __builtin_strlen __attribute__((__const__)) +#endif + + +#define NEW_H +typedef void *__builtin_va_list; +//extern "C" void __cxa_pure_virtual() {;} + +typedef int div_t; +typedef int ldiv_t; + + +typedef void *__builtin_va_list; +//extern "C" void __cxa_pure_virtual() {;} + + + +#include "arduino.h" +#include +//#undef F +//#define F(string_literal) ((const PROGMEM char *)(string_literal)) +#undef PSTR +#define PSTR(string_literal) ((const PROGMEM char *)(string_literal)) + +//typedef unsigned char uint8_t; +//typedef unsigned int uint8_t; + +#define pgm_read_byte_near(address_short) uint8_t() +#define pgm_read_byte(address_short) uint8_t() +#define pgm_read_word(address_short) uint16_t() +#define pgm_read_dword(address_short) uint32_t() +#define pgm_read_float(address_short) float() +#define pgm_read_ptr(address_short) short() + +#include "Babito2Anniversary.ino" +#endif +#endif diff --git a/Gaia2Anniversary/Babito2Anniversary/__vm/Compile.vmps.xml b/Gaia2Anniversary/Babito2Anniversary/__vm/Compile.vmps.xml new file mode 100644 index 0000000..eed1274 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/__vm/Compile.vmps.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/__vm/Configuration.Debug.vmps.xml b/Gaia2Anniversary/Babito2Anniversary/__vm/Configuration.Debug.vmps.xml new file mode 100644 index 0000000..a33fb5d --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/__vm/Configuration.Debug.vmps.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/__vm/Configuration.Release.vmps.xml b/Gaia2Anniversary/Babito2Anniversary/__vm/Configuration.Release.vmps.xml new file mode 100644 index 0000000..6ac0248 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/__vm/Configuration.Release.vmps.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/__vm/Upload.vmps.xml b/Gaia2Anniversary/Babito2Anniversary/__vm/Upload.vmps.xml new file mode 100644 index 0000000..eed1274 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/__vm/Upload.vmps.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Gaia2Anniversary/Babito2Anniversary/src/arduino folders read me.txt b/Gaia2Anniversary/Babito2Anniversary/src/arduino folders read me.txt new file mode 100644 index 0000000..71714e3 --- /dev/null +++ b/Gaia2Anniversary/Babito2Anniversary/src/arduino folders read me.txt @@ -0,0 +1,14 @@ +##################################################### + Arduino How To: Use sub folders for source code + http://www.visualmicro.com/ +##################################################### + +* .INO code can exist in the project folder and '\src' folder. +* .Cpp/.c/.S/.h etc. can exist in the project folder, the '\src' folder and in any folder(s) below the '\src' folder. +* .Cpp/.c/.S/.h sources in shared code projects should follow the same folder rules (because they are merged with the project sources into a temporary build folder prior to compile). + +* Use the 'Show All Files' icon above the 'Solution Explorer' to switch between 'included project files' and 'physical files/folders'. +* Source code in the project folder will always be compiled regardless of inclusion in the project. This functionality can be disabled in Global Options. + + +