Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Buck-Conv-Arduino
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gabriel Canela
Buck-Conv-Arduino
Commits
0b167969
Commit
0b167969
authored
Nov 16, 2023
by
Gabriel Canela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V0.0 Adicionada a Estrutura Básica
parents
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
Arduino.ino
Arduino.ino
+34
-0
Documentação/buck_converter_schematic.png
Documentação/buck_converter_schematic.png
+0
-0
README.md
README.md
+2
-0
No files found.
Arduino.ino
0 → 100644
View file @
0b167969
#include <Arduino.h>
//Analog input pin for the potentiometer
int
potentiometer_pin
=
A0
;
// PWM output pin
int
pwm_pin
=
3
;
void
setup
()
{
// Adjusts the pin to input mode
pinMode
(
potentiometer_pin
,
INPUT
);
// Adjusts the pin to output mode
pinMode
(
pwm_pin
,
OUTPUT
);
// Adjusts the PWM frequency to 980.39 Hz.
// By default arduino PWM frequency is 490.20 Hz,
// but this value is not high enough to have a stable DC output voltage in low duty cycles.
TCCR2B
=
TCCR2B
&
B11111000
|
B00000011
;
}
void
loop
()
{
// Reads the voltage of the potentiometer to a value between 0 to 1023
// The resolution of ADC on Arduino is 10 bits.
int
duty_cycle
=
analogRead
(
potentiometer_pin
);
// Maps the value from [0 1023] to [0 255] for the PWM function of Arduino
int
duty_cycle_mapped
=
map
(
duty_cycle
,
0
,
1024
,
0
,
254
);
// Sets the PWM signal duty cyle value, 0->0%, 254->100%
analogWrite
(
pwm_pin
,
duty_cycle_mapped
);
}
\ No newline at end of file
Documentação/buck_converter_schematic.png
0 → 100644
View file @
0b167969
343 KB
README.md
0 → 100644
View file @
0b167969
Buck-Conv-Arduino
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment