Skip to content

Instantly share code, notes, and snippets.

/*
* Test_1.c
*
* Created on: Oct 5, 2017
* Author: heldjj
* Inputs: 1x pushbutton w/pullup resistor
* Outputs:3 indicator leds. (1x pushbutton indicator, 1x PWM brightness display, 1x pulse display)
* Purpose: To be able to control the ouput pulse length and fire only once per button press.
*
*/
/*
* Actuator_Test_1.c
*
* Created on: Oct 5, 2017
* Author: heldjj
*
* Purpose: Create 4 pwm pins that can have the duty cycle varried independently from eachother.
*/
#include <avr/io.h>
int State=0;
void setup() {
pinMode(5,OUTPUT); // Set Digital pin 5 to output
}
void loop() {
int sensorValue = analogRead(A0); // Read analog value off of photoresistor
float voltage = sensorValue * (5.0 / 1023.0); // Calculate voltage with a resolution of 1023
if(voltage<3){ //not recording
// Hardware Connections
#define R1 0xE
#define R2 0xD
#define R3 0xB
#define R4 0x7
#define C1 0x3
#define C2 0x5
#define C3 0x6
struct KeyPadCon{
// Challenge 4 Microcontolers Fall 2015 Josh Held
#include <18f4520.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#include "../../Library/18f4520ptr.h"
#include "../../Library/modifiedlcd.h"
float incoming, outgoing, RPM;
#INT_RDA // Interrupt for recieve data Only for USART Receive interupt Triggered by proper USART packet receive
void int_rda_isr(){
// Challenge 4 Microcontolers Fall 2015 Josh Held
#include <18f4520.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#include "../../Library/18f4520ptr.h"
#include "../../Library/Keypad.h"
#include "../../Library/modifiedlcd.h"
int16 press1, press2;
float incoming, outgoing;
//Trasmitter
#include <18f4520.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#include "../Library/18f4520ptr.h"
#include "../Library/modifiedlcd.h"
#INT_RDA // Interrupt for recieve data Only for USART Receive interupt Triggered by proper USART packet receive
void int_rda_isr(){
// Receive usart
#include <18f4520.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#include "../Library/18f4520ptr.h"
#include "../Library/modifiedlcd.h"
#INT_RDA
void int_rda_isr(){
//output_high(PIN_A0);
Enter file contents here#include <18f4520.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#include "../Library/18f4520ptr.h"
#include "../Library/Keypad.h"
#include "../Library/modifiedlcd.h"
main(){
int16 press1, press2;
lcd_init();
Enter file contents here// 10/21/2015 Fall Microcontrolers
#include <18f4520.h>
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP
#include "../Library/18f4520ptr.h"
#include "../Library/modifiedlcd.h"
unsigned int OFCnt=0;
#INT_TIMER1 // Counter Overflows
void Int_timer1_isr(){