Add Gaia's 2-anniversary surprise code
This commit is contained in:
parent
98bffa2663
commit
9c8909765f
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
# Ignore Visual Studio compiled files
|
||||||
|
Debug/
|
||||||
|
Release/
|
BIN
Gaia2Anniversary/.vs/Babito2Anniversary/v16/.suo
Normal file
BIN
Gaia2Anniversary/.vs/Babito2Anniversary/v16/.suo
Normal file
Binary file not shown.
BIN
Gaia2Anniversary/.vs/Babito2Anniversary/v16/Browse.VC.db
Normal file
BIN
Gaia2Anniversary/.vs/Babito2Anniversary/v16/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
25
Gaia2Anniversary/Babito2Anniversary.sln
Normal file
25
Gaia2Anniversary/Babito2Anniversary.sln
Normal file
@ -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
|
143
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.ino
Normal file
143
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.ino
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
Name: Babito2Anniversary.ino
|
||||||
|
Created: 01/01/2021 15:36:29
|
||||||
|
Author: Lorenzo Dellac<EFBFBD>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Servo.h>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
BIN
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skb
Normal file
BIN
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skb
Normal file
Binary file not shown.
BIN
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skp
Normal file
BIN
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.skp
Normal file
Binary file not shown.
132
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj
Normal file
132
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary.vcxproj
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Misc Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>xml;json;txt;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Babito2Anniversary.ino" />
|
||||||
|
<None Include="src\arduino folders read me.txt">
|
||||||
|
<Filter>Misc Files</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="__vm\.Babito2Anniversary.vsarduino.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup />
|
||||||
|
</Project>
|
BIN
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary1.skp
Normal file
BIN
Gaia2Anniversary/Babito2Anniversary/Babito2Anniversary1.skp
Normal file
Binary file not shown.
@ -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 <pins_arduino.h>
|
||||||
|
//#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
|
12
Gaia2Anniversary/Babito2Anniversary/__vm/Compile.vmps.xml
Normal file
12
Gaia2Anniversary/Babito2Anniversary/__vm/Compile.vmps.xml
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
Gaia2Anniversary/Babito2Anniversary/__vm/Upload.vmps.xml
Normal file
12
Gaia2Anniversary/Babito2Anniversary/__vm/Upload.vmps.xml
Normal file
File diff suppressed because one or more lines are too long
@ -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.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user