<commit_before>/*
 * Use potentiometer to set servo arm angle through Servo API.
 * This example uses an 8-bit timer.
 * The servo I use in this example is a TowerPro SG90.
 * 
 * Wiring:
 * - on ATmega328P based boards (including Arduino UNO):
 *   - A1: connected to the wiper of a 10K pot or trimmer, which terminals are connected between Vcc and Gnd
 *   - D6: connected to servo signal pin (orange wire)
 */

#include <fastarduino/boards/board.h>
#include <fastarduino/analog_input.h>
#include <fastarduino/time.h>
#include <fastarduino/pulse_timer.h>
#include <fastarduino/devices/servo.h>

constexpr const board::Timer TIMER = board::Timer::TIMER0;
using TCALC = timer::Calculator<TIMER>;
using TPRESCALER = TCALC::TIMER_PRESCALER;

// Constants for servo and prescaler to be used for TIMER
//constexpr const uint16_t MAX_PULSE_US = 2400;
//constexpr const uint16_t MIN_PULSE_US = 900;
constexpr const uint16_t MAX_PULSE_US = 2400;
constexpr const uint16_t MIN_PULSE_US = 544;
constexpr const uint16_t NEUTRAL_PULSE_US = 1500;
constexpr const uint16_t PULSE_FREQUENCY = 50;
constexpr const TPRESCALER PRESCALER = TCALC::PulseTimer_prescaler(MAX_PULSE_US, PULSE_FREQUENCY);

// PIN connected to servo signal
constexpr const board::DigitalPin SERVO_PIN1 = board::PWMPin::D6_PD6_OC0A;<commit_msg>Fix pulse constants for my servo.<commit_after>/*
 * Use potentiometer to set servo arm angle through Servo API.
 * This example uses an 8-bit timer.
 * The servo I use in this example is a TowerPro SG90.
 * 
 * Wiring:
 * - on ATmega328P based boards (including Arduino UNO):
 *   - A1: connected to the wiper of a 10K pot or trimmer, which terminals are connected between Vcc and Gnd
 *   - D6: connected to servo signal pin (orange wire)
 */

#include <fastarduino/boards/board.h>
#include <fastarduino/analog_input.h>
#include <fastarduino/time.h>
#include <fastarduino/pulse_timer.h>
#include <fastarduino/devices/servo.h>

constexpr const board::Timer TIMER = board::Timer::TIMER0;
using TCALC = timer::Calculator<TIMER>;
using TPRESCALER = TCALC::TIMER_PRESCALER;

// Constants for servo and prescaler to be used for TIMER
constexpr const uint16_t MAX_PULSE_US = 2400;
constexpr const uint16_t MIN_PULSE_US = 544;
constexpr const uint16_t NEUTRAL_PULSE_US = 1500;
constexpr const uint16_t PULSE_FREQUENCY = 50;
constexpr const TPRESCALER PRESCALER = TCALC::PulseTimer_prescaler(MAX_PULSE_US, PULSE_FREQUENCY);

// PIN connected to servo signal
constexpr const board::DigitalPin SERVO_PIN1 = board::PWMPin::D6_PD6_OC0A;
{'fraction_non_alphanumeric': 0.08514851485148515, 'fraction_numerical': 0.03287128712871287, 'mean_word_length': 5.116222760290557, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1536079', 'n_tokens_mistral': 998, 'n_tokens_neox': 895, 'n_words': 274}