Fourth Class and First Quiz (19/01/17)

Fourth Class and First Quiz (19/01/17)

Link of the Picture: Link of the picture

In this fouth class i learn one transversal topic in mastery topics  that is using platforms such as socrative (link) and kahoot (link) for taking quizzes. With these quizzes i reaffirmed that the language C++ is a compile language because it needs a compiler to run like the terminal we use for coding with the text editor.

tumblr_mm7wirs80b1snsa9ro1_1280

Link of the image: Link of the picture

socrative-logo-hires

Link of the picture:Link of the picture

And i also learnt and reaffirmed that the word for representing all kinds of numbers in C++ is integer and NOOOOT!!! float. (2!=2.0000)

number

Link of the picture:Link of picture

fun-numbers-23514002

Link of picture: Link of picture

 

Anuncio publicitario

My Project For the Course TC1017 and Expo Ing

My Project For the Course TC1017 and Expo Ing

What I am going to do for my Project is an automated lock or smart lock (smart lamp) that can be wireless opened it by a smart device from a long distance but also control it with a physical switch. So I am going to do this because it gives a solution to a problem i experienced while working for a company. When was the time for eating and returned to the building i had to wait a long time to someone opening me the door turning an electric lock with just a physical switch because they were eating and the physical switch was just too far for them. Also with the clients  someone had to open the door to touch the physical switch and opened the door and i think it does not have to be like this. So that are the reasons why i am going to do this optomized project and i want to presented it in Expo Ing.

How Am I going to do this project?

To succeed for this project I am going to do a system control programming 2 microcontrollers (A microcontroller is a integrated circuit device who controls outputs like the lock in fuction of inputs in this case the switches) in languague C with open source software called Arduino where these controllers are going to read the inputs between the smart device and the physical switch and decide whether of those can open or close the electric lock. Therefore I am going to follow this diagram i designed:

xor-automatico

moc3011

At first I am going to build this circuit i designed where it has the physical switch that utilizes Altern Current of 127 Volts of AC and the microcontroller utilizes Direct Current of 5 VCD so the diagram converts the altern current of 127VAC to direct current of 5 volts to one controller while the other microcontroller is reading the state of the smart device sending the value to the other controller that has the physical switch connected.

The smart device can be a cellphone so i will design an app that can talk with one controller using a wireless interface or module. The module i will be using is a bluetooth module HC05:

hc05

For the communication between the HC05 and the cellphone i need to design the app for it and the language i will be using is the graphic language in the environment of app inventor.

head

App Inventor is a free open source tool software developed by Google Labs in 2011 to create apps Android. After of a short period of time, the development of this software goes with Massachusetts Institute of Technology (MIT). Using the web browser you can create Android apps  in a visual and easy way thanks to the basic tools. In App Inventor it starts designing the app through the app in a graphic environment. This kind of environment involves a program language based on visual language in Java Blocks like one called Scratch. The libraries of these blocks have been developed by the MIT and it is free use. In these blocks we found functions, sentences and elements very common in this kind of visual programming language. Thanks to this we can create apps Android in a fast and easy way with no having knowledge in Java. Once the design finish with the blocks of the app, you can download it and install it in an Android device o well we can taste whether an emulator that provides the software or using an Android Device.

appinventor-diagrama-1

app

app-language-blocks

app-language-blocks2

One controller leads with the smart device and the other controller decides whether any of the inputs can turn on or off the electric lock. This controller is also programed with the languague C and works as a logic circuit XOR where the truth table is here:

xor

This is what the second controller is working on. He reads the states of the inputs with 4 if sentences and decides in which condition turn the lock on or off.

You can find the code for GitHub:

Languague C to the microcontrollers

Code of the first microcontroller:
void setup() {
// put your setup code here, to run once:
//DECLARACIÓN Y CONFIGURACIONES DE PUERTOS DE ENTRADAS Y SALIDAS O VARIABLES O COMUNICACIÓN SERIAL
pinMode(2,INPUT);
pinMode(3,OUTPUT);
Serial.begin(9600);
digitalWrite(3,LOW);

}

void loop() {
// put your main code here, to run repeatedly:

char dato=Serial.read();

if(digitalRead(2)==LOW && dato==’a’)
{digitalWrite(3,LOW);}

if(digitalRead(2)==LOW && dato==’b’)
{digitalWrite(3,HIGH);}

if(digitalRead(2)==HIGH && dato==’a’)
{digitalWrite(3,HIGH);}

if(digitalRead(2)==HIGH && dato==’b’)
{digitalWrite(3,LOW);}

}

Code of the second microcontroller:

void setup() {
// put your setup code here, to run once:

pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,OUTPUT);
digitalWrite(4,LOW);
}

void loop() {
// put your main code here, to run repeatedly:

if(digitalRead(2)==LOW && digitalRead(3)==LOW)
{digitalWrite(4,LOW);}

if(digitalRead(2)==LOW && digitalRead(3)==HIGH)
{digitalWrite(4,HIGH);}

if(digitalRead(2)==HIGH && digitalRead(3)==LOW)
{digitalWrite(4,HIGH);}

if(digitalRead(2)==HIGH && digitalRead(3)==HIGH)
{digitalWrite(4,LOW);}

}

 

 

Second Class, Second Blog (Blog of the second class 12/01/17) and Hello World.cpp

helloworld

So in this class that i had on last Thursday we started how to enter the wonderful world of coding and writing in C++. To make a program using this techique in C++ you need 2 things:

  1. A hackable Text Editor for the 21st Century
  2. A Terminal

The Text Editor is the tool where you can write and save YOUR PROGRAM in C++ with the extention in .cpp. The Terminal is the tool which shows the user to manage and see all the input and output data (101010101) compiling the information given from the text editor (C++).

In my last post I talked about the terminal that i am using called ubuntu in windows 10 where i installed with the help of my teacher who gave me a link in First Class, First Blog (Blog of the first class 9/01/17) and in this second class the teacher recommended to me and the class to use the text editor that was missing to getting started with coding our first code call the famous Hello World in C++.

The Text Editor I will be using for the class is called Atom where you can download it to any kind of operative system like windows or mac at this link https://atom.io/ where is the official website and where io stands for input and output of data:

atom2

atom

After installing atom i created a new C++ file and when i saved in a C++ file with the extention .cpp, the code turn out in colors like in this picture:

atom-hello

After that i open my terminal ubuntu but i wrote at first the command for compile (compile is the action of transforming any kind of languague to machine languague that only is 1 or 0 1010101010101110)  and the software needed it to install a package of fuctions and configurations. So after installing the package i wrote the command again from the new c++ file with the command g++ hello.cpp and the command line of ubuntu or terminal told me that it had a fatal error of no finding hello.cpp showing in the next photograph:

firsr-error So i had my first error where i fixed it with the help of my teacher using these commands to tell the terminal to search in the place where i had the file (hello.cpp) in downloads.

  1. The command was cd =Change of directory
  2. Next add a command called mnt=It stands for mounting and this helps the terminal to go search in the local disk drive C
  3. After add the source of the hello.cpp from local disk drive C (My User called fabco)
  4. All the instruction transforms to: cd /mnt/c/Users/fabco/Downloads

And by doing a video tutorial that i made reafirming that part at this link: First Tutorial Hello World 12/01/17 AND THIS OTHER LINK #TC1017 Second Class Hello World 12/01/17 !!

Finally with the command ./a. out tells the terminal to run de C++ file

hello-world

This code will be here and in Github:

Link in Github: https://github.com/fabcor95/TC1017

if you do not want the hello.cpp there is it in here with comments. The comments are very useful to detect errors and create new things:

#include <iostream> //Library to call all the

//fuctions of inputs and outputs of data in languague
//C++

using namespace std; //In C++ we need a command

// that everytime goes with the instructions of input and outputs
//of data that is call std but with this command helps writing
//these std out of the main because the machine factorizes them

int main () //Begin of the program
{

cout<<"Hello World"<<endl; //command of out data in form of text

}// End of the program

First Class, First Blog (Blog of the first class 9/01/17)

First Class, First Blog (Blog of the first class 9/01/17)

Hello World of solving problems with programming!!!

#TC1017

I am going to talk about the first class of this week where i saw a new innovative introduction of this course. I saw a creative Page One of the course.

I learnt how to create my tweeter account that i will be using for communication for our teacher and after that i had some questions on how to create a blog account until I booked a meeting with the teacher ken bauer.

In the first class i showed the teacher of a project that i have been working for months that it answers a problem that i have experienced but i am gonna to talk about it in another blog as my project for the course.

The teacher told us that the language we will be using for this course #TC1017 is a simple environment of C++ but on my blogs and i am going to combine it with my knowledge of C++ and the many other applications that can have.

In this first class the teacher gave me a web page or link How to Install and Use the Linux Bash Shell on Windows 10 where i could download the tool for the environment i will be using for the course because i have windows 10 and the teacher gave me the chance of installing a kind of the environment of linux on my windows operating system that it is called bash en ubuntu en windows. I read this link and i posted on my twiteer account the progress. Here are the photograhps of that progress:  downloading ubuntu3.png

 

downloading bosh.png

On my next blog i will talking about my second class, the terminal and the text editor where you can write de C++ code and what resources i need it. Therefore the code for Hello World!!