User Tools

Site Tools


user:jmendoza:portfolio:datacomm4

Project: YOUR PROJECT NAME HERE

A project for Data Communications by Jason Mendoza and Casey Cornair during the SEMESTER YEAR.

This project was begun on early November 2013 and is anticipated to take a few days.

Objectives

The purpose of this project is to transmit a signal from one raspberry pi to another raspberry and have the receive pi put the signal out to an LED.

Prerequisites

In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:

  • All of our previous work on these systems with concerns to accessing the GPIO.
  • Everything being correctly wired.
  • Two pi's.
  • Some preexisting code to be transmitted.

Background

The idea of this project is to get that much closer to a working morse code sender and receiver. By using the second pi we are proving not only reception but maleability. This means that once the informations is received it can be operated on and eventually deciphered.

Scope

Give a general overview of your anticipated implementation of the project. Address any areas where you are making upfront assumptions or curtailing potential detail. State the focus you will be taking in implementation.

Attributes

State and justify the attributes you'd like to receive upon successful approval and completion of this project.

  • attribute1: why you feel your pursuit of this project will gain you this attribute
  • attribute2: why you feel your pursuit of this project will gain you this attribute
  • etc…

Procedure

http://www.instructables.com/id/Blinking-LED-with-Raspberry-Pi-1/

wire upo both pi's appropriately given the GPIO diagram.running the code on one pi as well as the other. This will require the reading of pins on the receiving maching, reaasignment and output.

Code

Code for single wire conuit

#include<stdio.h>
#include<stdlib.h>
#include"rpi.h"
 
 
int i;
void check();
int main()
{
	if(map_peripheral(&gpio) == -1) 
  	{
    		printf("Failed to map the physical GPIO registers into the virtual memory space.\n");
    		return -1;
	}
        OUT_GPIO(10);
	INP_GPIO(22);
	GPIO_CLR = 1 << 22;
 
	while(1)
        {
		GPIO_CLR = 1 << 22;
 
                i = GPIO_READ(22);
                //printf("%d \n", i);
                if(i !=0)
                {
	                GPIO_SET = 1 << 10;
        	        usleep(140000);
			printf( "%d/n", &i);
        		if(i !=0)
       		 	{
                		printf("-");
        		}
        		else
        		{
               			printf(".");
        		}
        		usleep(100000);
		}
                else
                {
                	GPIO_CLR = 1 << 10;
                }
        }
}
#include "rpi.h"
#include<stdlib.h>
int i,j,k,l;
int main()
{
  if(map_peripheral(&gpio) == -1) 
  {
    printf("Failed to map the physical GPIO registers into the virtual memory space.\n");
    return -1;
  }


/*	INP_GPIO(17);
        OUT_GPIO(7);
*/
	INP_GPIO(22);
        OUT_GPIO(10);
/*
	INP_GPIO(9);
        OUT_GPIO(11);
	INP_GPIO(8);
	OUT_GPIO(23);
*/
        GPIO_CLR = 1 << 8;
        GPIO_CLR = 1 << 9;
        GPIO_CLR = 1 << 22;
        GPIO_CLR = 1 << 17;




	while(1)
	{


		i = GPIO_READ(8);
		printf("%d \n", i);
		if(i !=0)
		{
		GPIO_SET = 1 << 23;
		}
		else
		{
		GPIO_CLR = 1 << 23;
		}

                j = GPIO_READ(9);
                printf("%d \n", j);
                if(j !=0)
                {
                GPIO_SET = 1 <<11;
                }
		else
		{
                GPIO_CLR = 1 << 11;
                }

                k = GPIO_READ(22);
                printf("%d \n", k);
                if(k !=0)
                {
                GPIO_SET = 1 << 10;
                }
		else
		{
                GPIO_CLR = 1 << 10;
                }

                l = GPIO_READ(17);
                printf("%d \n", l);
                if(l !=0)
                {
                GPIO_SET = 1 << 7;
                }
		else
		{
                GPIO_CLR = 1 << 7;
                }



	}
}

Execution

*blink

Reflection

So this was not so bad! relatively painless even! the biggest problem was the fact that we pretty much had the wiring diagram upsidedown the ENTIRE time and managed to luck our way through the pin assignment. The completion of this project is a huge moral booster.

References

user/jmendoza/portfolio/datacomm4.txt · Last modified: 2013/12/13 13:52 by jmendoza