<commit_before>/**
 * 
 * This is a 'c' program that demos the usage of the mraa library 
 * to set up and use PWM Intel Edison/Galileo.
 * The intensity with which the LED connected at port D5 glows is 
 * controlled by the position of rotary angle sensor connected to analog
 * port A0
 * 
 * setup:
 * Rotary angle sensor is connected to analog port A0 and 
 * the LED is connected to port D5
 * 
 * Compilation (on the Intel Galileo/Edison and not on host):
 * gcc -o adc adc.c -lmraa
 * 
 * Demo:
 * Run the application
 * ./adc
 * 
 * You can exit this demo by hitting ctrl+c
 * 
 * You can find the tutorial related to this program here:
 * 
 */

#include <mraa.h>
#include <signal.h>


#define PWM_PIN      5        /**< The pin where the LED is connected */
#define ADC_PIN      0        /**< The ADC pin */
#define ADC_MAX   (1024.0)    /**< Maximum value output by a 10-bit ADC */

volatile int keepRunning;

/** Signal handler used to stop this application cleanly */
void handler(int arg)
{
    (arg);
    keepRunning = 0;
}


int main(void)
{
    mraa_pwm_context       pwmPin;   /* The PWM pin context */
    mraa_aio_context       adcPin;   /* ADC pin context */
    
    float                  intensity; /* Intensity with which LED is to glow */
    float                  adcValue;  /* Read ADC value */<commit_msg>Added link to the tutorail<commit_after>/**
 * 
 * This is a 'c' program that demos the usage of the mraa library 
 * to set up and use PWM Intel Edison/Galileo.
 * The intensity with which the LED connected at port D5 glows is 
 * controlled by the position of rotary angle sensor connected to analog
 * port A0
 * 
 * setup:
 * Rotary angle sensor is connected to analog port A0 and 
 * the LED is connected to port D5
 * 
 * Compilation (on the Intel Galileo/Edison and not on host):
 * gcc -o adc adc.c -lmraa
 * 
 * Demo:
 * Run the application
 * ./adc
 * 
 * You can exit this demo by hitting ctrl+c
 * 
 * You can find the tutorial related to this program here:
 * https://navinbhaskar.wordpress.com/2016/04/25/cc-on-intel-edisongalileo-part4adc/ 
 *
 */

#include <mraa.h>
#include <signal.h>


#define PWM_PIN      5        /**< The pin where the LED is connected */
#define ADC_PIN      0        /**< The ADC pin */
#define ADC_MAX   (1024.0)    /**< Maximum value output by a 10-bit ADC */

volatile int keepRunning;

/** Signal handler used to stop this application cleanly */
void handler(int arg)
{
    (arg);
    keepRunning = 0;
}


int main(void)
{
    mraa_pwm_context       pwmPin;   /* The PWM pin context */
    mraa_aio_context       adcPin;   /* ADC pin context */
    
    float                  intensity; /* Intensity with which LED is to glow */
    float                  adcValue;  /* Read ADC value */
{'fraction_non_alphanumeric': 0.09074475777295733, 'fraction_numerical': 0.013376717281272595, 'mean_word_length': 2.3950920245398772, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '714308', 'n_tokens_mistral': 931, 'n_tokens_neox': 851, 'n_words': 357}