Tuesday, 8 November 2016

Arduino - Introduction

Arduino is a open source prototype platform based on an easy-to-use hardware and software. It consists of a circuit board, which can be programed and a ready-made software called Arduino IDE, which is used to write and upload the code to the physical board. It is referred as the microcontroller.



Few key features are,
  • Arduino boards are able to read analog input signals.
  • Arduino boards are able to read digital input signals.
  • Data are collected from different sensors and turn it into an output.
  • Convert output such as activating a motor, turning LED on/off, connect to the cloud and many other actions.
  • You can control your board functions by sending a set of instructions to the microcontroller on the board via Arduino IDE.
  • Unlike most previous programmable circuit boards, Arduino does not need an extra piece of hardware (called a programmer/Loader) in order to load a new code onto the board. You can simply use a USB cable.
  • Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program.
  • Finally, Arduino provides a standard form factor that breaks the functions of the micro-controller into a more accessible package.
Few Arduino Boards are,

For more information please follow the video below,
For More Such Interesting Videos Please Visit our YouTube Channel Silly Tech TV

Thursday, 3 November 2016

Pattern Question in Just Dial Campus Driver - C Program

/*
$##############$
$#$##########$#$
$#$#$######$#$#$
$#$#$#$##$#$#$#$
*/
#include<stdio.h>
int main() {
 int i,j;
 for(i=1; i<=4; i++)  {
  for(j=1; j<=i; j++) {
   printf("$#");
  }
  for(j=8; j>i*2; j--) {
   printf("##");
  }
  for(j=1; j<=i; j++) {
   printf("#$");
  }
  printf("\n");
 }
}

Monday, 24 October 2016

Write a function sum_fibo(n) which sums all the even valued terms in the Fibonacci sequence till 'N'

/*
Write a function sum_fibo(n) which sums all the even valued terms in the Fibonacci sequence till 'N' where n<4*10^6
By Starting with 1 and 2, the first 10 terms will be : 1, 2, 3, 5, 8, 13, 21, 34, 55, 89
*/


#include<stdio.h>
int sum_fibo(int n) {
 int sum=0,i;
 int f1=0, f2=1, f3;
 for(i=0; i<n; i++) {
  f3=f1+f2;
  if(f3%2==0) {
   sum = sum + f3;
  }
  f1 = f2;
  f2 = f3;
 }
 return sum;
}
int main() {
 int n;
 printf("Enter N:");
 scanf("%d", &n);
 printf("\nResult: %d", sum_fibo(n));
 return 0;
}

List all the natural numbers below 'N' that are multiples of 3 or 5.

/*
List all the natural numbers below 'N' that are multiples of 3 or 5.
sum_multiples(10)
we get, 3 + 5 + 6 + 9 = 23
*/

#include<stdio.h>
int sum_multiples(int n) {
 int i,sum=0;
 // Numbers from 3 to 'N'
 for(i=3; i<n; i++) {
  // Check for divisibility by 3 or 5
  if(i%3==0 || i%5==0) {
   // Add the number which is multiple of 3 or 5
   sum = sum + i;
  }
 }
 // return the result
 return sum;
}

int main() {
 int n;
 printf("Enter N:");
 scanf("%d", &n);
 printf("\nResult: %d", sum_multiples(n));
 return 0;
}