Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Noteblock
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fxk8y
Noteblock
Commits
ccc4925e
Unverified
Commit
ccc4925e
authored
9 months ago
by
Andreas Horn
Browse files
Options
Downloads
Patches
Plain Diff
adds 7th and 8th valve
parent
76d81a8f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
noteblock.ino
+20
-12
20 additions, 12 deletions
noteblock.ino
with
20 additions
and
12 deletions
noteblock.ino
+
20
−
12
View file @
ccc4925e
...
...
@@ -17,23 +17,25 @@
#define VALVE_3 7 // PE6 // 4mm
#define VALVE_4 8 // PB4 // 4mm
#define VALVE_5 9 // PB5 // 4mm
#define VALVE_6 3 // PD0 // 4mm
#define VALVE_7 2 // PD1 // 4mm
#define NUM_VALVES
6
#define NUM_VALVES
8
// array of currently active notes, index 0 is the oldest one
static
int16_t
notes
[
NUM_VALVES
]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
static
int16_t
notes
[
NUM_VALVES
]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
// array of the length of the tone period required to create the tone
static
uint16_t
periods
[
NUM_VALVES
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
static
uint16_t
periods
[
NUM_VALVES
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
// array of the current state of the valve pins (for tone periods)
static
uint8_t
states
[
NUM_VALVES
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
static
uint8_t
states
[
NUM_VALVES
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
// array for the period timer helpers
static
uint64_t
lastNoteMicros
[
NUM_VALVES
]
=
{
0
,
0
,
0
,
0
,
0
,
0
};
static
uint64_t
lastNoteMicros
[
NUM_VALVES
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
// array of the valve pin numbers
static
const
uint8_t
valves
[
NUM_VALVES
]
=
{
VALVE_0
,
VALVE_1
,
VALVE_2
,
VALVE_3
,
VALVE_4
,
VALVE_5
};
static
const
uint8_t
valves
[
NUM_VALVES
]
=
{
VALVE_0
,
VALVE_1
,
VALVE_2
,
VALVE_3
,
VALVE_4
,
VALVE_5
,
VALVE_6
,
VALVE_7
};
static
float
noteToMidi
[
128
];
...
...
@@ -895,24 +897,30 @@ void loop() {
//digitalWrite(valves[i], states[i]);
switch
(
i
)
{
case
0
:
// PD4
case
0
:
// PD4
// 6mm
PORTD
^=
B00010000
;
break
;
case
1
:
// PC6
case
1
:
// PC6
// 6mm
PORTC
^=
B01000000
;
break
;
case
2
:
// PD7
case
2
:
// PD7
// 6mm
PORTD
^=
B10000000
;
break
;
case
3
:
// PE6
case
3
:
// PE6
// 4mm
PORTE
^=
B01000000
;
break
;
case
4
:
// PB4
case
4
:
// PB4
// 4mm
PORTB
^=
B00010000
;
break
;
case
5
:
// PB5
case
5
:
// PB5
// 4mm
PORTB
^=
B00100000
;
break
;
case
6
:
// PD0 // 4mm
PORTD
^=
B00000001
;
break
;
case
7
:
// PD1 // 4mm
PORTD
^=
B00000010
;
break
;
}
}
else
if
(
notes
[
i
]
==
-
1
)
{
// be sure to end notes that should be ended
digitalWrite
(
valves
[
i
],
LOW
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment