<commit_before>
/* 
  HiveMind Arduino Sensor Monitor
  Developed by <NAME>
  DAQ controller for single-hive urban beekeepers.
*/

/* --- Libraries --- */
#include "stdio.h"
#include <DHT.h>
#include <SoftwareSerial.h>
//#include <SD.h>

/* --- Pins --- */
#define SD_PIN 10
#define DHT_INTERNAL_PIN A0
#define DHT_EXTERNAL_PIN A1
#define RPI_POWER_PIN A5

/* --- Values --- */
#define DHT_TYPE DHT11
#define BAUD 9600
#define CHARS 8
#define BUFFER 128
#define DIGITS 4
#define PRECISION 2
#define INTERVAL 1
#define UPTIME 600
#define DOWNTIME 3000

/* --- Functions --- */
float get_int_C(void);
float get_int_RH(void);
float get_ext_C(void);
float get_ext_RH(void);

/* --- Objects --- */
DHT internal(DHT_INTERNAL_PIN, DHT_TYPE);
DHT external(DHT_EXTERNAL_PIN, DHT_TYPE);
//Sd2Card card;
//SdVolume volume;
//SdFile root;

/* --- Strings --- */
char int_C[CHARS];
char int_RH[CHARS];
char ext_C[CHARS];
char ext_RH[CHARS];
char output[BUFFER];

/* --- State --- */
int counter = 0; // seconds on
boolean on = true; // start on

/* --- Setup --- */
void setup() {
  
  // Setup Serial
  Serial.begin(BAUD);
  
  // Setup Relay
  pinMode(RPI_POWER_PIN, OUTPUT);
  digitalWrite(RPI_POWER_PIN, LOW); // start on
  
  // Setup SD
//  pinMode(SD_PIN, OUTPUT);
//  while (!card.init(SPI_HALF_SPEED, SD_PIN)) {
//    continue; // connection failed
//  }
//  if (!volume.init(card)) {
//    return;
//  }
//  root.openRoot(volume);
  
  // Setup Sensors
  internal.begin();
  external.begin();
}

/* --- Loop --- */
void loop() {
  
  // Read Sensors
  dtostrf(get_ext_RH(), DIGITS, PRECISION, ext_RH); 
  dtostrf(get_ext_C(), DIGITS, PRECISION, ext_C);
  dtostrf(get_int_RH(), DIGITS, PRECISION, int_RH);
  dtostrf(get_int_C(), DIGITS, PRECISION, int_C);
  sprintf(output, "{'Internal_C':%s, 'External_C':%s, 'Internal_RH':%s, 'External_RH':%s}", int_C, ext_C, int_RH, ext_RH);
  
  // Log to file<commit_msg>monitor<commit_after>
/* 
  HiveMind Arduino Sensor Monitor
  Developed by <NAME>
  DAQ controller for single-hive urban beekeepers.
*/

/* --- Libraries --- */
#include "stdio.h"
#include <DHT.h>
#include <SoftwareSerial.h>
//#include <SD.h>

/* --- Pins --- */
#define SD_PIN 10
#define DHT_INTERNAL_PIN A0
#define DHT_EXTERNAL_PIN A1
#define RPI_POWER_PIN A5

/* --- Values --- */
#define DHT_TYPE DHT11
#define BAUD 9600
#define CHARS 8
#define BUFFER 128
#define DIGITS 4
#define PRECISION 2
#define INTERVAL 1
#define UPTIME 600
#define DOWNTIME 3000

/* --- Functions --- */
float get_int_C(void);
float get_int_RH(void);
float get_ext_C(void);
float get_ext_RH(void);

/* --- Objects --- */
DHT internal(DHT_INTERNAL_PIN, DHT_TYPE);
DHT external(DHT_EXTERNAL_PIN, DHT_TYPE);
//Sd2Card card;
//SdVolume volume;
//SdFile root;

/* --- Strings --- */
char int_C[CHARS];
char int_RH[CHARS];
char ext_C[CHARS];
char ext_RH[CHARS];
char output[BUFFER];

/* --- State --- */
int counter = 0; // seconds on
boolean on = true; // start on

/* --- Setup --- */
void setup() {
  
  // Setup Serial
  Serial.begin(BAUD);
  
  // Setup Relay
  pinMode(RPI_POWER_PIN, OUTPUT);
  digitalWrite(RPI_POWER_PIN, LOW); // start on
  
  // Setup SD
//  pinMode(SD_PIN, OUTPUT);
//  while (!card.init(SPI_HALF_SPEED, SD_PIN)) {
//    continue; // connection failed
//  }
//  if (!volume.init(card)) {
//    return;
//  }
//  root.openRoot(volume);
  
  // Setup Sensors
  internal.begin();
  external.begin();
}

/* --- Loop --- */
void loop() {
  
  // Read Sensors
  dtostrf(get_ext_RH(), DIGITS, PRECISION, ext_RH); 
  dtostrf(get_ext_C(), DIGITS, PRECISION, ext_C);
  dtostrf(get_int_RH(), DIGITS, PRECISION, int_RH);
  dtostrf(get_int_C(), DIGITS, PRECISION, int_C);
  sprintf(output, "{'internal_temp':%s, 'external_temp':%s, 'internal_humidity':%s, 'external_humidity':%s}", int_C, ext_C, int_RH, ext_RH);
  
  // Log to file
{'fraction_non_alphanumeric': 0.174163179916318, 'fraction_numerical': 0.014121338912133892, 'mean_word_length': 3.2833146696528557, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5244369', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1514, 'n_words': 345}