This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
void main() | |
{ | |
double a,b,c; | |
printf("Enter triangle lengths a, b, c: \n"); | |
scanf("%lf %lf %lf", &a,&b,&c); | |
if (a+b<=c || a+c<=b || b+c<=a || a<=0 || b<=0 || c<=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am tieubinhco on github. | |
* I am tieubinhco (https://keybase.io/tieubinhco) on keybase. | |
* I have a public key ASAECKCnumGhNDDzmdcEwbAnNyBLODNUDiHFDfh9PU4tGgo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Faf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sign_of(float x) | |
{ | |
if (x >= 0) | |
return 1; | |
else | |
return -1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void w1(int rotation, int direct) | |
{ | |
analogWrite(PWM1, rotation); | |
if (direct == 1) | |
{ | |
digitalWrite(IN1A, HIGH); | |
digitalWrite(IN2A, LOW); | |
} | |
else if (direct == -1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Semantic Versioning Specification (SemVer) | |
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119. | |
Software using Semantic Versioning MUST declare a public API. This API could be declared in the code itself or exist strictly in documentation. However it is done, it SHOULD be precise and comprehensive. | |
A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. X is the major version, Y is the minor version, and Z is the patch version. Each element MUST increase numerically. For instance: 1.9.0 -> 1.10.0 -> 1.11.0. | |
Once a versioned package has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version. | |
Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float read_speed(int select) | |
{ | |
//read velocity of selected motor | |
//return velocity in rad/s | |
const float PI=3.1415926; | |
const int Encoder_1_round = 44; //define number of pulses in one round of encoder | |
currentEncoder = Encoder_1.read(); | |
float rot_speed; //rotating speed in rad/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Encoder.h> | |
#define IN1 7 | |
#define IN2 8 | |
#define PWM 5 | |
#define EN_A 2 | |
#define EN_B 3 | |
//Declare encoder function | |
Encoder Enc(EN_A, EN_B); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Encoder.h> | |
#define IN1 7 | |
#define IN2 8 | |
#define PWM 5 | |
#define EN_A 2 | |
#define EN_B 3 | |
//Declare encoder function | |
Encoder Enc(EN_A, EN_B); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function x=gauss(A,b) | |
%This function solves system of algebraic equations using Gaussian method | |
%Ax=b | |
%Input: matrix A, column vector b | |
%Output vector x | |
n=size(A,1); | |
b=b(:); %make sure b is a column vector. | |
nb=n+1; | |
Ab=[A b]; %extended matrix |
OlderNewer