<commit_before>/*
**  ModuleNameATmega.ino
**  MakerWear ModuleName Module's ATmega Program.
**
**  Description
**  Description
**  Description
**
**
**  ATmega328 Pin Configurations:
**
**  Pin 1  (Reset):                          Pin 28  (A5):  
**  Pin 2  (D0/RX):                          Pin 27  (A4):
**  Pin 3  (D1/TX):                          Pin 26  (A3):
**  Pin 4  (D2):                             Pin 25  (A2):
**  Pin 5  (D3/PWM):                         Pin 24  (A1):
**  Pin 6  (D4):                             Pin 23  (A0):       Module Input
**  Pin 7  (PWR):                            Pin 22  (GND):
**  Pin 8  (GND):                            Pin 21  (AREF):
**  Pin 9  (XTAL1):                          Pin 20  (AVCC):
**  Pin 10 (XTAL2):                          Pin 19  (D13):
**  Pin 11 (D5/PWM):                         Pin 18  (D12):
**  Pin 12 (D6/PWM):                         Pin 17  (D11/PWM):
**  Pin 13 (D7):                             Pin 16  (D10/PWM):
**  Pin 14 (D8):                             Pin 15  (D9/PWM):   Module Output
**
**
**  Created on xx/yy/zz.
**  By <NAME>
**  Modified on xx/yy/zz.
**  By <NAME>
**
**  MakerWear Link:
**  Github Link:      github.com/myjeeed/MakerWear
**
*/

#include <SignalProcessing.h>
#include <Wire.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

int input_pin = A0;                         //pin 23 on ATmega328
int filter_size = 15;                       //Noise reduction filter size
int output_pin = 9;                         //pin PB1 (OC1A) PWM

SignalProcessing input(input_pin, filter_size);

void setup()
{
  mlx.begin();
}

void loop()
{
    int input_val = cutAndMap(input.filteredAnalogRead(AVERAGE), 50, 975, 0, 1023);


    int temperature = mlx.readObjectTempF();

    //mapping everything to: 32F - 150F
    
    int output_val = cutAndMap(temperature, 32, 150, 0, 255);
    analogWrite(output_pin, output_val);
}<commit_msg>Temperature Reader: Won't output when input is 0<commit_after>/*
**  ModuleNameATmega.ino
**  MakerWear ModuleName Module's ATmega Program.
**
**  Description
**  Description
**  Description
**
**
**  ATmega328 Pin Configurations:
**
**  Pin 1  (Reset):                          Pin 28  (A5):  
**  Pin 2  (D0/RX):                          Pin 27  (A4):
**  Pin 3  (D1/TX):                          Pin 26  (A3):
**  Pin 4  (D2):                             Pin 25  (A2):
**  Pin 5  (D3/PWM):                         Pin 24  (A1):
**  Pin 6  (D4):                             Pin 23  (A0):       Module Input
**  Pin 7  (PWR):                            Pin 22  (GND):
**  Pin 8  (GND):                            Pin 21  (AREF):
**  Pin 9  (XTAL1):                          Pin 20  (AVCC):
**  Pin 10 (XTAL2):                          Pin 19  (D13):
**  Pin 11 (D5/PWM):                         Pin 18  (D12):
**  Pin 12 (D6/PWM):                         Pin 17  (D11/PWM):
**  Pin 13 (D7):                             Pin 16  (D10/PWM):
**  Pin 14 (D8):                             Pin 15  (D9/PWM):   Module Output
**
**
**  Created on xx/yy/zz.
**  By <NAME>
**  Modified on xx/yy/zz.
**  By <NAME>
**
**  MakerWear Link:
**  Github Link:      github.com/myjeeed/MakerWear
**
*/

#include <SignalProcessing.h>
#include <Wire.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

int input_pin = A0;                         //pin 23 on ATmega328
int filter_size = 15;                       //Noise reduction filter size
int output_pin = 9;                         //pin PB1 (OC1A) PWM

SignalProcessing input(input_pin, filter_size);

void setup()
{
  mlx.begin();
}

void loop()
{
    int input_val = cutAndMap(input.filteredAnalogRead(AVERAGE), 50, 975, 0, 1023);


    int temperature = mlx.readObjectTempF();

    //mapping everything to: 32F - 150F
    
    int output_val = cutAndMap(temperature, 32, 150, 0, 255);
    
    // shouldn't do anything when input voltage is 0
    if(cutAndMap(input.filteredAnalogRead(AVERAGE), 50, 975, 0, 1023) <= 15)
      analogWrite(output_pin, 0);
    else
      analogWrite(output_pin, output_val);
}
{'fraction_non_alphanumeric': 0.13313967562333576, 'fraction_numerical': 0.06463326071169208, 'mean_word_length': 1.517976843388178, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '22863', 'n_tokens_mistral': 1652, 'n_tokens_neox': 1398, 'n_words': 380}